CSS: Placing divs left/center/right inside header

后端 未结 6 1320
-上瘾入骨i
-上瘾入骨i 2020-12-28 16:31

I\'ve been trying to create a site with the following structure:

But I can\'t seem to get the header correct (e1 left, e2 centered, e3 right). I want the three

6条回答
  •  被撕碎了的回忆
    2020-12-28 17:00

    I'm using a similar idea to what RevCocnept suggested with the width: 33%, except using display: inline-block instead of float: left. This is to avoid removing the div elements inside #header from the flow of the page and causing the height of #header to become zero.

    #header > div {
        display: inline-block;
        width: 31%;
        margin: 5px 1%;
    }
    

    Demo

提交回复
热议问题