CSS-网站顶部的空格

时间:2018-07-25 17:52:13

标签: css

我的网站顶部有一个空格,我的样式表中使用的是margin="0",它应该可以,但不能。

这是一个wordpress主题网站,我查看了页面源代码,发现下面的样式代码(我认为该样式代码由wordpress生成),但是在任何地方都找不到它进行编辑。

<style type="text/css" media="screen">
    html { margin-top: 32px !important; }
    * html body { margin-top: 32px !important; }
    @media screen and ( max-width: 782px ) {
        html { margin-top: 46px !important; }
        * html body { margin-top: 46px !important; }
    }
</style>

请说明我该怎么做?

1 个答案:

答案 0 :(得分:0)

不要直接向body/html标签声明任何样式,请在body标签打开一个新的div标签并在body标签关闭之前将其关闭,然后再声明空白div,请参见以下示例。

<html>
<head>
<body>
 <div class="container">
 </div>
</body>
</head>
</html>

.container
 {
   margin-top: 32px;
 }
相关问题