How to remove margin space around body or clear default css styles

后端 未结 7 1493
夕颜
夕颜 2020-11-22 06:09

I am admittedly a beginner, but I also did a fair amount of searching before posting this. There seems to be extra space around my div element. I also would like to point ou

7条回答
  •  无人共我
    2020-11-22 06:26

    I found this problem continued even when setting the BODY MARGIN to zero.

    However it turns out there is an easy fix. All you need to do is give your HEADER tag a 1px border, aswell as setting the BODY MARGIN to zero, as shown below.

    body { margin:0px; }
    
    header { border:1px black solid; }
    

    If you have any H1, H2, tags within your HEADER you will also need to set the MARGIN for these tags to zero, this will get rid of any extra space which may show up.

    Not sure why this works, but I use Chrome browser. Obviously you can also change the colour of the border to match your header colour.

提交回复
热议问题