# Drawing lines on top and bottom on figures

I would like to create a figure with one line on top of it, and another one at the bottom, that separate the figure form the text. I have tried using the following code:

\begin{figure}[h]
\par\noindent\rule{\textwidth}{0.1pt}
\centering
\caption{Diagrama que muestra los diferentes posibles estados sobre la capacidad de campo del suelo. Fuente: \url{http://www.soilwater.com.au/laboratory.html}}
\par\noindent\rule{\textwidth}{0.1pt}
\end{figure}


The bottom line works just fine, but the top line gets stuck to the figure image, and the vspace is just separating the image from the caption.

• Is this what you want: \par\noindent\rule{\textwidth}{0.1pt}\par\medskip? – Sigur Oct 20 '18 at 17:28

try the following:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{url}

\begin{document}
\begin{figure}[h]
\centering
\rule[1ex]{\textwidth}{0.1pt}