CSS莫名其妙的缩进
该文件中有一个缩进,导致元素“scroller”的左边距恰好为 30px; 。我找不到造成这种情况的原因。它让我陷入困境。
问题出在这个文件的某个地方: http://www.divethegap.com/update/z-css/admin /master.css
html
<div id="wrapper">
<div id="scroller" align="left" style="left:0; text-align:left; margin:0; padding:0;">
<ul id="thelist">
<li>Pretty row 1</li>
<li>Pretty row 2</li>
<li>Pretty row 3</li>
<li>Pretty row 4</li>
<li>Pretty row 5</li>
<li>Pretty row 6</li>
</ul>
</div>
</div>
附加CSS
#wrapper {
position:absolute;
z-index:0;
top:0px;
bottom:0px;
left:0;
width:300px;
background:#555;
overflow:auto;
text-align:left;
float:left;
}
#scroller {
position:relative;
/* -webkit-touch-callout:none;*/
-webkit-tap-highlight-color:rgba(0,0,0,0);
float:left;
width:300px;
padding:0;
overflow:auto;
list-style:none;
left:0;
padding:0;
margin:0;
}
#scroller ul {
position:relative;
list-style:none;
padding:0;
margin:0;
width:100%;
text-align:left;
overflow:auto;
}
#scroller li {
padding:0 10px;
height:40px;
line-height:40px;
border-bottom:1px solid #ccc;
border-top:1px solid #fff;
background-color:#fafafa;
font-size:14px;
list-style:none;
}
谁能减轻我的痛苦并找到有问题的CSS?
There is an indent in this file that is causing the element 'scroller' to have a left margin of exactly 30px; . I cannot find what is causing this. It is driving me up the wall.
The problem is somewhere is this file:
http://www.divethegap.com/update/z-css/admin/master.css
The html
<div id="wrapper">
<div id="scroller" align="left" style="left:0; text-align:left; margin:0; padding:0;">
<ul id="thelist">
<li>Pretty row 1</li>
<li>Pretty row 2</li>
<li>Pretty row 3</li>
<li>Pretty row 4</li>
<li>Pretty row 5</li>
<li>Pretty row 6</li>
</ul>
</div>
</div>
Additional CSS
#wrapper {
position:absolute;
z-index:0;
top:0px;
bottom:0px;
left:0;
width:300px;
background:#555;
overflow:auto;
text-align:left;
float:left;
}
#scroller {
position:relative;
/* -webkit-touch-callout:none;*/
-webkit-tap-highlight-color:rgba(0,0,0,0);
float:left;
width:300px;
padding:0;
overflow:auto;
list-style:none;
left:0;
padding:0;
margin:0;
}
#scroller ul {
position:relative;
list-style:none;
padding:0;
margin:0;
width:100%;
text-align:left;
overflow:auto;
}
#scroller li {
padding:0 10px;
height:40px;
line-height:40px;
border-bottom:1px solid #ccc;
border-top:1px solid #fff;
background-color:#fafafa;
font-size:14px;
list-style:none;
}
Can anyone alleviate me of my suffering and find the offending CSS?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 text.css 中: http://www.divethegap.com/update /z-css/admin/text.css
您的所有列表项都应用了 margin-left:
当您不需要它时,您必须覆盖它,或者如果您在任何地方都不需要它,则将其删除。
http://jsfiddle.net/Gpu3b/
搜索
/*固定
CSS 框。In text.css here : http://www.divethegap.com/update/z-css/admin/text.css
You have a margin-left applied to all of your list item:
You must override it when you don't want it or remove it if you don't need it anywhere.
http://jsfiddle.net/Gpu3b/
Search for the
/* Fixed
in the css box.测试一个简单的 CSS 重置:
Test a simple CSS Reset:
删除边距并添加所有内容。
Remove margins and apdding off everything.
修复了 99% 的问题: http://developer.yahoo.com/yui/reset/ CSS
您可以使用
* { margin: 0;填充:0; }
作为快速修复,但应该在生产中使用 CSS 重置表。The fix to 99% of these problems: http://developer.yahoo.com/yui/reset/CSS
You can use
* { margin: 0; padding: 0; }
as a quick fix, but a CSS reset sheet should be used for production.