Unordered List (
    ) default indent

前端 未结 8 1584
忘了有多久
忘了有多久 2020-12-03 10:15

Can anyone tell me why an unordered list has a default indent/padding applied to it? Can this be solved with a CSS Browser Reset?

8条回答
  •  被撕碎了的回忆
    2020-12-03 10:20

    I found the following removed the indent and the margin from both the left AND right sides, but allowed the bullets to remain left-justified below the text above it. Add this to your css file:

    ul.noindent {
        margin-left: 5px;
        margin-right: 0px;
        padding-left: 10px;
        padding-right: 0px;
    }
    

    To use it in your html file add class="noindent" to the UL tag. I've tested w/FF 14 and IE 9.

    I have no idea why browsers default to the indents, but I haven't really had a reason for changing them that often.

提交回复
热议问题