答案1
答案2
答案3
有以下 3 种方法可以实现此目的:
\documentclass{article}
\usepackage[x11names, table]{xcolor}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{framed}
\definecolor{shadecolor}{named}{LightSteelBlue4}
\setlength\FrameSep{3pt}
\usepackage{array, tabularx}
\begin{document}
\noindent\fcolorbox{SlateGray4!80}{SlateGray3}{\sffamily\color{white}%
\makebox[\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax]{Gap year\hfill July 2011--October 2012}}
\vskip\topsep
Some text some text some text some text some text some text some text some text some text
\begin{shaded*}\sffamily\color{NavajoWhite1!50}
\noindent Gap year\hfill July 2011--October 2012
\end{shaded*}
\color{black}
Some text some text some text some text some text some text some text some text some text
{\vskip\topsep\sffamily\color{white}\setlength\extrarowheight{1pt} \noindent\begin{tabularx}{\dimexpr\linewidth}{lXr}
\rowcolor{lightgray}Gap year & & July 2011--October 2012%
\end{tabularx}}
\end{document}