this might be a stupid question, but how can I center a photo in a div without using margins?
Is there a rule for other elements like the ‘text-align’ rule?
you can use relative positioning or the "margin: 0 auto" trick
Thanks, though I tried this and it didn’t work.
I tried it with all positioning:relative and absolute
That may be the problem. Try "position: relative" instead of "positioning:relative".
I normally have this is my reset stylesheet for generic classes i want to use wsuch as img_center
You can also use "text-align: center;"
I was using ‘position’ not ‘positioning’. I just used the word positioning in the post.
I need to center horizontally, though not vertically.
This looks like it will center both ways.
You must be logged in to reply to this topic.