大家好,我需要一些帮助来解决如何覆盖我的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;},但页面上的其他部分需要它才能正确显示。所以我的问题是,如何仅覆盖页面上的 postcomments 部分的 {margin: 0;padding: 0;}?
谢谢! :o)
大卫
更新: 好吧,还是无法正确地获取它。删除整个站点的 margin: 0px 会使站点看起来很糟糕。如果我必须为页面上的每个元素添加 margin: 0px 才能使它看起来像使用 * 一样,那就不好了。我仍然只需要绕过 .postcomments 部分就可以了。
<a>
)的边距填充。您还应该放弃使用!important
,并了解CSS特异性 - http://www.w3.org/TR/CSS2/cascade.html#specificity - Richard JP Le Guen