hi. i would like to know if any of you have found a way to center an element within another element, or just center an element in a page. For example, I have a logobar on top of my page, that is about 50% of the width of the page. I would like to center that without using relative positioning. I know the hack to make it work in IE
<div style="text-align: center;">
</div>
IE then centers the element between the div tags, because of the text-align.. But Mozilla and Phoenix/Firebird do not do this. Is there any attribute in CSS without using absolute positioning that we can use to center an element? something like a float: center;? This is really important ot me and i would appreciate any answers. Thanks a lot
how to center an element w/ css layout
how to center an element w/ css layout
Hi,
Make a div that will just contain your image and then put the image as the background imagve for the div. Then you can position it using the center center attributes.
HTH,
Jo
how to center an element w/ css layout
Hi,
Make a div that will just contain your image and then put the image as the background imagve for the div. Then you can position it using the center center attributes.
HTH,
Jo
Oops! That's supposed to be "image". :roll:
It also might help if I give an example.
div.topbar {background-image: url(topbar.jpg); background-repeat: no-repeat;}
Then, just call your <div class-"topbar"> where you want it on the page.