[英]How to remove white space left and right side of page?
I am trying to make a footer, but the left and right sides show some white space.我正在尝试制作页脚,但左侧和右侧显示了一些空白。 How to remove the white space?
如何去除空白?
Here is my code:这是我的代码:
<html>
<head>
<style>
footer {
background: none repeat scroll 0% 0% #DFDFDE;
padding: 120px 0px;
text-align: center;
position: relative;
}
.divider {
background: url('http://evablackdesign.com/wp-content/themes/ebd/images/footer-border.png')
repeat-x scroll center center transparent;
height: 7px;
width: 100%;
position: absolute;
top: -6px;
}
.container {
width: 930px;
margin: 0px auto;
}
</style>
</head>
<body>
<footer>
<div class="divider"></div>
<div class="container">
<h1>hiiiiiiiii</h1>
<br>
<h2>buyyyyyyyyyyyy</h2>
</div>
</footer>
</body>
</html>
The tag defines a footer for a document or section.标签定义文档或部分的页脚。
A element should contain information about its containing element.一个元素应该包含有关其包含元素的信息。
A footer typically contains the author of the document, copyright information, links to terms of use, contact information, etc.页脚通常包含文档的作者、版权信息、使用条款的链接、联系信息等。
The body has a default margin.正文有一个默认的边距。 Remove it via:
通过以下方式删除它:
html,body {
margin:0;
padding:0;
}
Most Web browsers have different default settings for the base margins and padding.大多数 Web 浏览器对基本边距和填充有不同的默认设置。 This means that if you don't set a margin and padding on your body and html tags, you could get inconsistent results on the page depending upon which browser you're using to view the page.
这意味着,如果您没有在 body 和 html 标签上设置边距和内边距,根据您用于查看页面的浏览器,您可能会在页面上获得不一致的结果。
The best way to solve this is to set all the margins and paddings on the html and body tags to 0:解决此问题的最佳方法是将 html 和 body 标签上的所有边距和内边距设置为 0:
html, body {
margin: 0px;
padding: 0px;
}
*{
width: 100%;
height: 100%;
padding: 0px;
margin: 0px;
overflow-x: hidden;
}
Add this to your style tag...将此添加到您的样式标签...
body {
margin: 0;
}
Just make sure to add this class to your CSS style.只需确保将此类添加到您的 CSS 样式中即可。
.container-fluid {
width: 100%;
margin: 0px;
padding: 0px;
}
Try out this code:试试这个代码:
html, body {
width: 100%;
margin: 0;
padding: 0;
overflow-x: hidden;
}
Your body has a default margin and padding and you need to override it.你的身体有一个默认的边距和填充,你需要覆盖它。 At the beginning of your style type.
在你的风格类型的开头。
body{
padding: 0;
margin: 0;
box-sizing: border-box
}
Try this bro, this is the simplest one, add it to your body selector.试试这个兄弟,这是最简单的一个,把它添加到你的身体选择器中。
body {
margin: 0px;
padding: 0px;
width: 100%;
}
For me, It's working对我来说,它正在工作
html, body { overflow-x: hidden; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.