I am trying to center an image inside a <p>
I used this website, http://www.w3.org/Style/Examples/007/center.en.html , and also found similar examples here but nothing seems to work.
My HTML code is
<div class="span4">
<h3 class="aglow" id="h3Body">Forms</h3>
<p>
<a class="btn btn-link "href="teacher_forms_list.html">
<img class="operationsButtons" src="NewForms.png" alt="forms">
</a>
</p>
</div>
and my CSS
img.operationsButtons {
display: block;
margin-left: auto;
margin-right: auto;
}
but for some reason the image is still on the left (attaching a picture of the image and a h3 that is centered over it)
thank you for your help
Simply put
p
{
text-align: center;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.