【问题标题】:Set background in body or html [duplicate]在正文或html中设置背景[重复]
【发布时间】:2015-09-20 07:22:09
【问题描述】:

在css中设置背景与body或html有区别吗?两者都有效。

例如:

body{
    background: green;
}

html{
    background: green;
}

【问题讨论】:

    标签: html css background


    【解决方案1】:

    这是一篇非常有趣的文章。

    https://css-tricks.com/html-vs-body-in-css/

    【讨论】:

      【解决方案2】:

      <html> 背景位于<body> 背景的“后面”。试试这个看看我的意思:

      html{
        background-color:blue;
      }
      body{
        background-color:white;
        max-width:400px;
        margin:0 auto;
      }
      

      【讨论】:

        猜你喜欢
        • 2023-03-20
        • 1970-01-01
        • 1970-01-01
        • 2011-01-09
        • 1970-01-01
        • 2019-01-25
        • 2014-07-02
        • 2014-07-01
        • 1970-01-01
        相关资源
        最近更新 更多