cannot eliminate space between 2 horizontal divs inside containing div

后端 未结 5 921
孤独总比滥情好
孤独总比滥情好 2021-02-04 16:00

Should be easy, right? Just set the outer containing div\'s padding to zero, and set the two side-by-side divs inside the outer div to have margin:0 but that\'s having no effe

5条回答
  •  南方客
    南方客 (楼主)
    2021-02-04 16:35

    The whitespace in the source between inline blocks leads to a gap in the layout. By removing the space (whether it's a single space or some line breaks doesn't matter) the elements will touch as intended.

    Formatting of the code can be retained at a slight cost, either by commenting out the whitespace or by making the whitespace occur within tags.

    Using comments:

    Content
    Content

    Placing linebreak inside tag:

    Content
    Content

提交回复
热议问题