css - List Item Background Image - Neighbor Floated Content Overlaps -
i've used list item background images customized bullets hundreds of times in past, , somehow never came across issue.
essentially, have img floated left of unordered list. bullet background images set top-left of each li. however, floated image covering bullets, browser treating list if it's still full width (as if floated image isn't there).
it's bit hard explain. here screenshot notes. http://img695.imageshack.us/img695/1328/cssquestion.jpg
here code snippets (sorry, can't upload server @ moment):
<h2>about us</h2> <img src="image.jpg" class="img-left" /> <h3>heading</h3> <p>text</p> <ul> <li>list item one</li> <li>list item two</li> <li>list item three</li> </ul> ul { padding: 0; margin: 0; } ul li { background: url(../images/bg-main-bullet.gif) top left no-repeat; list-style: none; padding: 0; margin: 0; } .img-left {float: left; margin: 0 19px 0 0;}
does have ideas how achieve desired result?
any tips or input appreciated! thanks
the default style position lists "outside" meaning appear outside of related padding or margin. presumably have margin or padding on list or list items, pushing them past right side of graphic.
the fix set list style position "inside". try adding stylesheet (customize specificity of ul
fit needs):
ul{ list-style-position: inside; }
Comments
Post a Comment