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

前端 未结 18 2583
猫巷女王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:23

    The easiest solution is to crate a table with 3 columns and center that table.

    html:

     

    Content1

    Content2

    css:

    #cont 
    {
      margin: 0px auto;    
      padding: 10px 10px;
    }
    
    #left
    {    
      width: 200px;
      height: 160px;
      border: 5px solid #fff;
    }
    
    #center
    {
      width: 200px;
      height: 160px;
      border: 5px solid #fff;
    }
    
    #right
    {
      width: 200px;
      height: 160px;
      border: 5px solid #fff;
    }
    

提交回复
热议问题