How can I remove space (margin) above HTML header?

后端 未结 8 1847
栀梦
栀梦 2020-11-29 05:01

I am creating a website.

I have written the HTML part and now I am writing the stylesheet. But there is always some space above my header. How can I remove it?

相关标签:
8条回答
  • 2020-11-29 05:20

    To prevent unexpected margins and other browser-specific behavior in the future, I'd recommend to include reset.css in your stylesheets.

    Be aware that you'll have to set the h[1..6] font size and weight to make headings look like headings again after that, and many other things.

    0 讨论(0)
  • 2020-11-29 05:27

    Try margin-top:

    <header style="margin-top: -20px;">
        ...
    

    Edit:

    Now I found relative position probably a better choice:

    <header style="position: relative; top: -20px;">
        ...
    
    0 讨论(0)
提交回复
热议问题