Page is a not externally linkable
- Code, Content, and Presentation
-- CSS
---- Text-indent on list items


alt131 - 7:44 am on Jul 15, 2011 (gmt 0)


Whew, did you two take a tea break? ;)

Anways Danepak, hopefully this explanantion will make some sense of what has been happening.

First, a good trick when working with lists is to set a 1px outline (or border if working ie<8)) on the ul and li. The reason fos suggesting that is because if you do you can easily see that list-style-position: inside positions the marker (bullet point) inside the principle box - which is the box drawn around the text. list-style-position: outside positions the marker outside that principle box. So if you have multiple lines of text and you want the left-most edges of the text to align, use list-style-position: outside.

Second, best I can tell, the posted code was trying to override the default rendering of list-style-position:inside by pushing the principle box to the right, then trying to drag the first line back using a negative text-indent to try to get the left edges of the multiple lines of text to align. Add in the default margin/padding difference between browsers and you can see why there were variations, plus complete chaos when you added on a change to list-style-position.

So, towards a solution. Rather than using list-style-position: inside then trying to adjust using text-indent, delete the text-indent, use list-style-position: outside, and reduce the cross-browsers differences by zeroing out the margins/padding. The following may not give you the exact design you want, but should get you started.
#services ul {
padding:0;
margin:0;
border:1px solid blue;
}

#services li {
margin:0;
padding:0;
border:1px solid red;
/* outside required if you have multi-line list items*/
list-style: square outside;
/*Should be consistent cross-browser, adjust left margin as required for the design - replace the px with the ems if you still have them*/
margin:15px 15px -13px;
}

<div id="services">
<ul>
<li>List item<br>That wraps</li>
<li>List item<br>That wraps</li>
</ul>
</div>

Does that get you any closer?

[edit reason] Removing random smilies from code

[edited by: alt131 at 1:41 pm (utc) on Jul 16, 2011]


Thread source:: http://www.webmasterworld.com/css/4339403.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com