thejerm Posted April 3, 2005 Posted April 3, 2005 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? ><center>...</center> is not valid xhtml Quote
TCH-Dick Posted April 3, 2005 Posted April 3, 2005 Have you tried enclosing it in a div? ><div align="center"><img src="/logo.jpg" /></div> You could also try ><p align="center"><img src="/logo.jpg" /></p> Quote
owatagal Posted April 3, 2005 Posted April 3, 2005 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.