Jump to content

"floating" Image Center


Recommended Posts

on my site I use a css class "floatimgleft" to float my images left and then I wrap my text around them. There are some images that I would like to be centered without text wraping (just an image centered on the page). reading css rules there is no

>float: center;

and when I try to sub

>text-align: center;

it doesnt work either. Does anyone know how to center an image on the page?


is not valid xhtml

Link to comment
Share on other sites

You can try adding a new class for the center images:


>img.center {
text-align: center;
margin: 0 auto;
display: block;


I think you have to have the margin: 0 auto; in there to get it to actually center. You may not need the display: block bit.


Yout just have to remember to assign the new class to whichever images you're dealing with.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...