What is the correct way to do a CSS Wrapper?

后端 未结 9 2127
后悔当初
后悔当初 2020-12-07 12:45

I have heard a lot of my friends talk about using wrappers in CSS to center the \"main\" part of a website.

Is this the best way to accomplish this? What is best pra

9条回答
  •  旧巷少年郎
    2020-12-07 13:12

    /******************
    Fit the body to the edges of the screen
    ******************/    
    
    body {
             margin:0;
             padding:0;
        }
    
    header {
         background:black;
         width:100%;
    }
    
    .header {
         height:200px;
    }
    
    nav {
         width:100%;
         background:lightseagreen;
    }
    
    .nav {
         padding:0;
         margin:0;
    }
    
    .nav a {
         padding:10px;
         font-family:tahoma;
         font-size:12pt;
         color:white;
    }
    
    /******************
    Centered wrapper, all other content divs will go inside this and will never exceed the width of 960px.
    ******************/
    
        .wrapper {
             width:960px;
             max-width:100%;
             margin:0 auto;
        }
    
    
    
    
    
        
    
    

提交回复
热议问题