Framed answer environment

Here's a quick and dirty solution with mdframed

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}


\global\mdfdefinestyle{redbox}{%
linewidth=2pt,
linecolor=red,
innertopmargin=1.2\baselineskip,
skipabove={\dimexpr0.5\baselineskip+\topskip\relax},
needspace=2\baselineskip,
frametitlefont=\sffamily\bfseries,
frametitlefontcolor=black,
fontcolor=red,
innerleftmargin=1em,
leftmargin=-1em,
innerrightmargin=1em,
rightmargin=-1em,
innerbottommargin=1em
}
\makeatletter
\renewrobustcmd\mdfcreateextratikz{\node[black,fill=white,xshift=1cm] at (P-|O) {\mdf@frametitlefont{Answer}};}
\makeatother

\begin{document}

\lipsum[3]
\begin{mdframed}[style=redbox]
\lipsum[2]
\end{mdframed}

\end{document}

enter image description here


An example using tcolorbox for framed boxes.

\documentclass{article}
\usepackage{amsmath}
\usepackage[most]{tcolorbox}

\newtcolorbox{myanswer}[1][]{%
    enhanced, title=Answer, colframe=red, 
    colback=white, sharp corners, colupper=red,
    fonttitle=\ttfamily,coltitle=black,
    attach boxed title to top left = {xshift=5mm,yshift=-2.5mm} ,
    boxed title style={size=small, colframe=gray, sharp corners,colback=white},
    #1}

\begin{document}

\begin{enumerate}
\item Is $5x\left(x^{-\frac{1}{2}}yz^3\right)^2$ equal to $5y^2z^6$?

\begin{myanswer}
Let us simplify $5x\left(x^{-\frac{1}{2}}yz^3\right)^2$ and verify whether or not is equal to $5y^2z^6$. Thus,
\[\begin{split}5x\left(x^{-\frac{1}{2}}yz^3\right)^2 & = 5x(x^{-1}y^2z^6)\\
& = 5y^2z^6\end{split}\]
Hence, $5x\left(x^{-\frac{1}{2}}yz^3\right)^2 = 5y^2z^6$
\end{myanswer}
\end{enumerate}

\end{document}

enter image description here