How to align 3 divs (left/center/right) inside another div?

前端 未结 18 2620
猫巷女王i
猫巷女王i 2020-11-21 20:48

I want to have 3 divs aligned inside a container div, something like this:

[[LEFT]       [CENTER]        [RIGHT]]

Container div is 100% wid

18条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-21 21:26

    You can try this:

    Your html code like this:

    and your css code like this:

    #container{width:100%;}
    #left{float:left;width:100px;}
    #right{float:right;width:100px;}
    #center{margin:0 auto;width:100px;}
    

    so, it's output should be get like this:

    [[LEFT]       [CENTER]        [RIGHT]]
    

提交回复
热议问题