Remove Extra Space at Bottom of HTML List Item

前端 未结 6 680
刺人心
刺人心 2020-12-31 05:20

Is there any way to remove the extra space displayed at the bottom of an HTML List Item tag without setting a fixed height on the list item? I.e. I would like the li

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-31 06:04

    li is wrapped in ul, which by default has some padding. Therefore as @Michael said, you have to zero out the padding of the ul element.

    To avoid these problems, always try to use reset.css.

    FYI: Browsers apply a default CSS on web pages. That's why you see h1 elements that big when there is no CSS in your site. Because browsers have a default CSS. And since browsers come from different companies, they have different default CSS. For example, a browser may use 10px of margin for paragraphs, while another browser user 12px. This means that you have always inconsistencies in your design. But a CSS reset is made of some general rules that removes these default CSS styles.

提交回复
热议问题