Html 从页面顶部删除白色条
我有以下代码,html和正文边距和填充设置为零,但它们在顶部仍然有一个间隙,为什么 CSSHtml 从页面顶部删除白色条,html,css,Html,Css,我有以下代码,html和正文边距和填充设置为零,但它们在顶部仍然有一个间隙,为什么 CSS html, body { margin: 0; padding: 0; } .mobile body { overflow: hidden; } .mobile #wrapper { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; } .mobile #scro
html, body {
margin: 0;
padding: 0;
}
.mobile body {
overflow: hidden;
}
.mobile #wrapper {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 100%;
}
.mobile #scroller {
height: 3000px;
}
.header {
background: url(../img/dark_exa.png) repeat;
height: 300px;
margin: 0 auto;
text-align: center;
}
.header h1 {
color: white;
}
HTML
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<title>Mobile Parallax with Stellar.js - Demo</title>
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div id="wrapper">
<div id="scroller">
<div class="header">
<h1>Product Title</h1>
</div>
</div>
</div>
<script src="lib/jquery.min.js" ></script>
<script src="lib/jquery.stellar.min.js"></script>
<script src="lib/iscroll.js"></script>
<script src="script.js"></script>
</body>
</html>
Stellar.js移动视差-演示
产品名称
添加边距:0代码>至。页眉h1
添加边距:0
到.header h1
您的
标记自动分配了一个边距属性,该边距将创建白色的“条”。如果删除顶部边距,请使用如下CSS
.header h1 {
margin-top:0;
}
…空白应该消失。您的
标记自动分配了一个边距属性,该边距将创建白色“条”。如果删除顶部边距,请使用类似于以下的CSS
.header h1 {
margin-top:0;
}
…空白应该消失。您的.mobile是用CSS编写的,而不是用HTML编写的。这可能是一个问题,因为没有一个CSS被应用您的.mobile是用CSS编写的,而不是用HTML编写的。这可能是一个问题,因为没有任何CSS被应用这是因为h1页边距。在标题h1中添加以下两行,这将解决问题
.header h1 {
margin: 0;
padding: 21px 0;
}
这是因为h1利润。在标题h1中添加以下两行,这将解决问题
.header h1 {
margin: 0;
padding: 21px 0;
}
将此添加到css中,使所有元素的边距均为0
* { margin: 0; }
将此添加到css中,使所有元素的边距均为0
* { margin: 0; }
我用这种方式。它对我有用
.ui-bar-inherit{border:0px !important;}
我用这种方式。它对我有用
.ui-bar-inherit{border:0px !important;}