简体   繁体   English

删除不必要的空白区域

[英]Removing unnecessary white-space

I have this fragment class which marks an area with red. 我有这个片段类,用红色标记一个区域。 My system is separated into two types: categories and rules. 我的系统分为两种类型:类别和规则。 When rules are fragmented, they receive the new css class well and it looks properly, but it's different with categories, they have that unnecessary white-space in top of the category. 当规则被分段时,它们很好地接收新的css类并且它看起来很合适,但它与类别不同,它们在类别的顶部有不必要的空白区域。

Here is a screenshot of what I mean: 这是我的意思的截图:

不必要的空白

Here is a live demo and you can check the source code for more information as I wont be able to provide the proper code since I am not the original author of the style: 这是一个现场演示,您可以查看源代码以获取更多信息,因为我不能提供正确的代码,因为我不是该样式的原始作者:

http://zirotec-uka.com/dugi/phpBB3/rules.php#rule1 http://zirotec-uka.com/dugi/phpBB3/rules.php#rule1

Thank you. 谢谢。

You have a rule specifying h3 { margin-top: 20px; } 你有一个规则指定h3 { margin-top: 20px; } h3 { margin-top: 20px; } . h3 { margin-top: 20px; } That is what causes the space. 这就是导致空间的原因。

You can override that with #main h3 { margin-top: 0; } 您可以使用#main h3 { margin-top: 0; } #main h3 { margin-top: 0; } . #main h3 { margin-top: 0; }

你需要设置

#main ul h3, #main ol h3 { margin-top: 0;}

You just need to remove the "padding" CSS element. 您只需要删除“填充”CSS元素。

You can do this statically as follows: 您可以静态执行此操作,如下所示:

$("#rule1").css("padding-top", "0px");

See how it looks now: 看看它现在的样子:

http://imgur.com/erWTH http://imgur.com/erWTH

This is being caused by a the padding in .fragment (style.php:4007) 这是由.fragment中的填充引起的(style.php:4007)

.fragment {
    padding: 5px 5px 0 5px;
    background-color: #ECD5D8;
    color: #BC2A4D;
    font-weight: bold;
}

You need to change this or override it. 您需要更改此项或覆盖它。

问题是由浏览器设置的默认填充,可以通过以下规则解决

#rules li{ padding:0px;}

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

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