大家好,我需要一些帮助来弄清楚如何覆盖我的 css 中的“* {margin: 0;padding: 0;}”。
原因是我有这个CSS:
.postcomments { width: 547px; padding: 5px 5px 5px 5px; margin: 0 0 5px 0;}
.postcomments a { text-decoration: underline;}
.postcomments ul { margin: 0; padding: 0; list-style-type: none;}
.postcomments ul li { width: 547px; margin: 0 0 5px 0; padding: 0; list-style-type: none;}
.postcomments .right { color: #474747; font-size: 11px; background: #fff url('http://www.nextbowluser.com/img/ucBG.gif') no-repeat top left; line-height: 17px; padding: 5px 0 0 0; width: 430px; position: relative; float: right; min-height: 50px;}
.postcomments .right .bottom { padding: 0 5px 15px 5px; background: #fff url('http://www.nextbowluser.com/img/ucBG.gif') no-repeat bottom right; min-height: 50px;}
.postcomments .arrow { left: -15px; top: 20px; position: absolute;}
.avatar { border: none !important;}
.postcomments .left {float: left; margin: 0 7px 0 0;}
.postcomments .gravatar { background: #fff; width: 80px; height: 60px; margin: 0 0px 0 0; padding: 3px;}
.postcomments .name { font-size: 11px; margin: 2px 0 0 0; color: #000;}
.avatar { border: none !important;}
没有 * {margin: 0;padding: 0;} 时它显示得很好:
1st comment
2nd comment
3rd comment
但是,当我将其添加到 CSS 时,它会使注释堆栈错误:
1st comment
2nd comment
3rd comment
我只需取出 * {margin: 0;padding: 0;} 但页面上的其他一些内容需要它才能正确显示。所以我的问题是,如何覆盖页面的评论部分的 {margin: 0;padding: 0;} ?
谢谢! :o)
David
更新:出色地。仍然无法正确获取。去掉整个网站的边距:0px - 它使网站看起来很糟糕。如果我必须向页面的每个元素添加 margin: 0px 以使其看起来像带有 * 的那样,那就不好了。我仍然只需要一些东西来绕过 .postcomments 部分,仅此而已。
你尝试过 !important 吗?
.postcomments {
margin: 15px !important;
padding: 15px !important;
}
我使用的是 15px,但你可以使用任何适合你的值
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)