I prefer using tcolorbox thinking that in future you may want the background to be fashionable. I have given many options (which are not needed for this particular case) in the tcbset so that you can play with them to suit your needs.
\documentclass{article}
\usepackage[most]{tcolorbox}
\tcbset{
frame code={},
center title,
left=0pt,
right=0pt,
top=0pt,
bottom=0pt,
colback=gray!70,
colframe=white,
width=\dimexpr\textwidth\relax,
enlarge left by=0mm,
boxsep=5pt,
arc=0pt,outer arc=0pt,
}
\begin{document}
\begin{tcolorbox}
\textsc{Extra Curricular Achievements}
\end{tcolorbox}
\end{document}

Here is another option using framed package.
\documentclass{article}
\usepackage{xcolor}
\usepackage{framed}
\definecolor{shadecolor}{RGB}{180,180,180}
\begin{document}
\begin{snugshade*}
\noindent\textsc{Extra Curricular Achievements}
\end{snugshade*}
\end{document}

Without extra packages:
\documentclass{article}
\usepackage{xcolor}
\definecolor{shadecolor}{RGB}{150,150,150}
\begin{document}
\noindent\colorbox{shadecolor}
{\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\textsc{Extra Curricular Achievements}}}
\end{document}

And convert it in to a macro:
\documentclass{article}
\usepackage{xcolor}
\definecolor{shadecolor}{RGB}{150,150,150}
\newcommand{\mybox}[1]{\par\noindent\colorbox{shadecolor}
{\parbox{\dimexpr\textwidth-2\fboxsep\relax}{#1}}}
\begin{document}
\mybox{\textsc{Extra Curricular Achievements}}
\end{document}
\colorboxcan not be split into several lines if it is too long. So the macro is most suited for coloring a few words. If you want to color several sentences which spread across several lines, it is better to usesoul– jdhao Nov 22 '16 at 12:31soulpackage. – jdhao Nov 22 '16 at 14:18soulto put some colour behind some text. – xealits Jan 26 '17 at 15:34soul– JTIM Apr 11 '18 at 07:36\color{}command will only color the text, not the text background. – jdhao Apr 11 '18 at 09:09soulgives me the impression you can not have different background colours in the same document. Is that correct? – Lars Abrahamsson Jul 28 '18 at 19:38\sethlcolorto change color). – jdhao Sep 05 '18 at 03:56\hlcommand does not accept diacritics by default (see the documentation, section 5.1). – Olivier Feb 05 '23 at 14:13soulpackage is that the margin around the text is minimal. In order to get something similar to thexcolorboxes, there is a way to add more top and bottom margin, redefining the correct leaders, like with\def\SOUL@ulleaders{\leaders\hrule\@depth 1ex\@height 2.5ex\relax}, based on this answer. Nevertheless, I cannot find how to add left and right margin to it. – Olivier Feb 05 '23 at 15:26