How to left align list items when an unordered list is centered on the page
I have a div that contains an unordered list with multiple list items. I am using ie6 and basically trying to center an unordered list on the screen, but at the same time want the text of the list item to be aligned to the left.
At the moment I have my unordered list in center tags that is centered in the list, but I would like it now to align the text of the actual text of the element.
Can anyone help as I cannot leave the text alignment now?
Thanks.
+2
a source to share
1 answer
You need to focus the content 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 it you can add a fix like this
body {
text-align: center;
}
div#theId {
text-align: left;
}
+1
a source to share