Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to indent list items using CSS when you have floating blocks?

Tags:

css

html-lists

I observed a relative strange behavior when I use floating images in a document. The list items indentation is made relatively to the 'red line' instead of the 'green' one.

Why is this happening and can I solve this?

<img style="float: left">
<p>some text</p>
<ul>
   <li>aaa</li
   <li>bbb</li
</ul>
<p>some other text</p>

alt text

like image 332
sorin Avatar asked Sep 26 '10 12:09

sorin


2 Answers

Just add ul { list-style-position: inside; } because by default it is set to outside, not sure why.

like image 52
bogdan Avatar answered Nov 14 '22 21:11

bogdan


I think you probably need to change the list style position to inside.

like image 40
Skilldrick Avatar answered Nov 14 '22 19:11

Skilldrick