gpt4 book ai didi

html - 重新格式化 css - 折叠冗余路径?

转载 作者:太空宇宙 更新时间:2023-11-04 05:11:26 25 4
gpt4 key购买 nike

我的样式表往往有很多冗余。例如,

/* example one: different attributes */
div#main_work > div.main_work table.data td span.rating,
div#main_work > div.main_work table.data td span.follow
{ white-space: nowrap; vertical-align: center; }

/* example two: same upstream, different downstream */
div#main_work > div.main_work > form table,
div#main_work > div.main_work > table,
div#main_work > div.main_work div table
{ width: 100%; margin: 0px; -moz-box-sizing: border-box; box-sizing: border-box; }

是否有语法上正确的方法来折叠它?

最佳答案

不,就是这样。您可以通过不那么具体来减轻一些麻烦,尤其是在 ID 选择器中:

/* example one: different attributes */
#main_work > .main_work .data .rating,
#main_work > .main_work .data .follow
{ white-space: nowrap; vertical-align: center; }

/* example two: same upstream, different downstream */
#main_work > .main_work > form table,
#main_work > .main_work > table,
#main_work > .main_work div table
{ width: 100%; margin: 0px; -moz-box-sizing: border-box; box-sizing: border-box; }

而且您可能可以进一步减少它。尽量使意图简洁明了。作为另一种选择,您可以尝试 LESS stylesheets .

关于html - 重新格式化 css - 折叠冗余路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9246350/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com