HTML layout: adding sidebar column to existing site

前端 未结 3 760
名媛妹妹
名媛妹妹 2021-02-07 13:44

I have a site with a body that looks like that:


  
...
3条回答
  •  死守一世寂寞
    2021-02-07 14:31

    I made a little jsfiddle to help you getting started. Also you might want to check if your div contents aren't messing up the whole CSS. Hope this helps.

    Edit : all colors and dimensions are dummy ones used for the example. It shoudk work with any dimension.

    html :

    
      
      
      
    ...

    css :

    .clearFix {
        clear: both;
    }
    
    #sidebar {
        width: 50px;
        height: 30px;
        background-color: green;
        float: left;
    }
    
    #header {
        width: 250px;
        background-color: red;
        margin-left: 55px;
    }
    
    #testLeft {
        width: 50px;
        height: 50px;
        float: left;
        background-color: pink;
    }
    
    #testRight {
        width: 50px;
        height: 50px;
        margin-left: 55px;
        background-color: purple;
    }
    
    #content {
        width: 250px;
        height: 20px;
        background-color: blue;
        margin-left: 55px;
    }
    
    #footer {
        width: 250px;
        height: 20px;
        background-color: orange;
        margin-left: 55px;
    }
    

提交回复
热议问题