Why do my list item bullets overlap floating elements

前端 未结 23 1260
半阙折子戏
半阙折子戏 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 18:36

    At http://archivist.incutio.com/viewlist/css-discuss/106382 I found a suggestion that worked for me: style the 'li' elements with:

    position: relative;
    left: 1em;
    

    Where you replace "1em" with the width of the left padding/margin that your list items would have if the float weren't present. This works great in my application, even handling the case where the bottom of the float occurs in the middle of the lists--the bullets shift back over to the (local) left margin just right.

提交回复
热议问题