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 625
孤城傲影
孤城傲影 2021-02-03 22:35

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


    
Some stuff...
Other stuff...
4条回答
  •  时光说笑
    2021-02-03 22:58

    An easy way to solve this problem is by getting rid of all the margins. And you can do that by the following code:

    * {
        margin:0;
    }
    

    This will solve the problem and will give you finer control over the margins of all elements.

提交回复
热议问题