CSS Margin: 0 is not setting to 0

前端 未结 11 1588
名媛妹妹
名媛妹妹 2020-12-06 09:13

I\'m a new comer to web designing. I created my web page layout using CSS and HTML as below. The problem is even though i set the margin to 0, the upper margin is not settin

相关标签:
11条回答
  • 2020-12-06 09:52

    You need to set the actual page to margin:0 and padding: 0 to the actual html, not just the body.

    use this in your css stylesheet.

    *, html {
        margin:0;
        padding:0;  
    }
    

    that will set the whole page to 0, for a fresh clean start with no margin or paddings.

    0 讨论(0)
  • 2020-12-06 09:56

    It's very simple. just add this to the body -

    body{
    margin:0;
    padding:0;
    overflow:hidden;
    }
    
    0 讨论(0)
  • 2020-12-06 09:58

    Try...

    body {
       margin: 0;
       padding: 0;
    }
    

    jsFiddle.

    Because of browsers using different default stylesheets, some people recommend a reset stylesheet such as Eric Meyer's Reset Reloaded.

    0 讨论(0)
  • 2020-12-06 09:58

    Try

    body {
        margin: 0;
        padding: 0;
    }
    

    instead of

    .body {
        margin: 0;
        padding: 0;
    }
    

    Do not select body with class selector.

    0 讨论(0)
  • 2020-12-06 10:00

    It seems that nobody actually read your question and looked at your source code. Here's the answer you all have been waiting for:

    #header_content p {
        margin-top: 0;
    }
    

    jsFiddle

    0 讨论(0)
提交回复
热议问题