I have a div that holds an unordered list with several list items. I am using ie6 and am basically trying to center the unordered list on the screen but at the same time want the actual list item text aligned to the left.
At the moment, I have my unordered list within the cent开发者_JS百科er tags, which has centered the list but I would actually like to now left align the actual list item text.
Why am I unable to left the align the text now?
You need to center the containing div
, not the entire document.
div#theID {
margin: 0 auto; /* auto margins will center */
width: 200px; /* needs a set width, for auto-margins */
}
In case IE 6 doesn't like this, you can add a fix like this
body {
text-align: center;
}
div#theId {
text-align: left;
}
精彩评论