当你有浮动块时,如何使用CSS缩进列表项? [英] How to indent list items using CSS when you have floating blocks?
本文介绍了当你有浮动块时,如何使用CSS缩进列表项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在文件中使用浮动图片时,我观察到一个相对奇怪的行为。列表项缩进是相对于红线而不是绿色。
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>
推荐答案
只需添加 ul {list-style-position: }
,因为默认情况下它被设置为outside,不知道为什么。
Just add ul { list-style-position: inside; }
because by default it is set to outside, not sure why.
这篇关于当你有浮动块时,如何使用CSS缩进列表项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文