Centering an image

User 23638 Photo


Registered User
30 posts

Want to add an image to the top, center of my index page. I am using, insert image. When I do align="right", the image is right justified. When I do align="middle" it stays left justified. There is no other text on this line.
User 187934 Photo


Senior Advisor
20,247 posts
Online Now

Here's one way.;)
In the css use
img.center {
display: block;
margin-left: auto;
margin-right: auto }

HTML
<img class="center" src="images/mycoolimage.jpg" alt="This is my image" />
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2161343 Photo


Registered User
76 posts

A non-CSS way:

<div align="center><img src blah blah></div>


Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.