Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Centering A Block Level Element

0 views
Skip to first unread message

Louis

unread,
Aug 3, 2006, 12:54:08 PM8/3/06
to
I must be missing something simple....

I would like to center a block, either a <span> or a <div>, on a page. I
tried different ways but failed to do that.

I would not want to do it with "position" property. Is there something
in CSS that would do something like "text-align:center;" to a block?

Thank you for your interest.

Marco

unread,
Sep 6, 2006, 2:06:04 AM9/6/06
to

"Louis" <t05...@hotmail.com> schreef in bericht
news:QSpAg.72437$B91.55082@edtnps82...

CSS
#center {
width: 200px;
margin-left: auto;
margin-right: auto;
}

HTML
<div id="center">

This should position the div in the center of the page without using the
"position: absolute" property.
It works fine in Firefox, but not always in IE.

Good luck.
Marco


0 new messages