Why do my list item bullets overlap floating elements

前端 未结 23 1216
半阙折子戏
半阙折子戏 2020-11-28 18:00

I have an (XHTML Strict) page where I float an image alongside regular paragraphs of text. All goes well, except when a list is used instead of paragraphs. The bullets of th

23条回答
  •  一向
    一向 (楼主)
    2020-11-28 18:39

    Why overflow: hidden works

    The solution is as easy as:

    ul {overflow: hidden;}
    

    A block box with overflow: other than visible establishes a new block formatting context for its contents. W3C recommendation: http://www.w3.org/TR/CSS2/visuren.html#block-formatting

    Example

    The buttons on my website, which are

  • in disguise, are made like this. Make the viewport (window) of your browser smaller to see the indenting in action.

    My website as an example

    Related answers

    • https://stackoverflow.com/a/710264/2192488
    • https://stackoverflow.com/a/16041390/2192488

    Article with examples

    • Overflow – a secret benefit

提交回复
热议问题