简体   繁体   English

的CSS <div> 造型

[英]CSS <div> styling

http://jsfiddle.net/Zmpyv/6/ http://jsfiddle.net/Zmpyv/6/

I have a page, where I use <div> to style the sheet. 我有一个页面,在其中使用<div>设置工作表的样式。 The problem is that it creates a border around the page. 问题在于它在页面周围创建了边框。 How can I remove this border? 如何删除该边框? Check out the jsfiddle to see what I mean. 查看jsfiddle,了解我的意思。 I am using position: static; 我正在使用position:static; I do not want to use fixed because then the page won't scroll correctly. 我不想使用固定的,因为这样页面将无法正确滚动。

Perhaps you're just talking about the native margin on <body> . 也许您只是在谈论<body>上的本机margin Try this; 尝试这个;

body {
    margin: 0;
}

Check out http://jsfiddle.net/Zmpyv/8 where I added the above CSS to your demo. 请访问http://jsfiddle.net/Zmpyv/8 ,在其中将上述CSS添加到您的演示中。

To avoid spending time fighting silly things like this, I recommend you have a look at normalize.css which applies this style for you, along with fixing a host of other discrepancies between browsers and in my opinion gives you a better starting point when authoring CSS. 为避免花时间与此类愚蠢的事情作斗争,我建议您看一下normalize.css ,它为您应用了这种样式,并修复了浏览器之间的许多其他差异,我认为这是编写CSS时的一个更好的起点。

Try setting this in div. 尝试在div中进行设置。

border:none

This will remove the border of any element.. 这将删除任何元素的边框。

<div class="headerClear" /></div>

see this div has unexpected close the right method is 看到此div意外关闭正确的方法是

<div class="headerClear"></div>

replace with this and add this to your css 替换为此并将其添加到您的CSS

body{ margin:0px;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM