CSS: How can I get rid of the default window “padding”? An element set to 100% width doesn't reach the window's borders

前端 未结 4 640
孤城傲影
孤城傲影 2021-02-03 22:35

So I have an element that is placed directly inside body:


    
Some stuff...
Other stuff...
4条回答
  •  有刺的猬
    2021-02-03 23:17

    body has default margins on all browsers, so all you need to do is shave them off:

    body {
        margin: 0;
        text-align: center;
    }
    

    You can then remove the negative margins from #header.

提交回复
热议问题