gpt4 book ai didi

css - CSS 中的 sharedAttr 是什么?

转载 作者:行者123 更新时间:2023-11-28 12:19:31 24 4
gpt4 key购买 nike

各位!

阅读本主题: Change background color of HTML <area> tag

我看到了一段CSS代码:

area{
sharedAttr: 'attribute';
}

我想知道这个 sharedAttr 是什么。什么是惊人的谷歌搜索:

css sharedAttr

仅给出 8(八!)个结果。我找不到任何提及 sharedAttr 在 css 表中的用法的文档。任何人都可以阐明这个主题吗?

提前致谢!

最佳答案

您引用的示例暗示(尽管相当糟糕)这样一个事实,即您可以使用相当通用的选择器定义一个或多个 CSS 属性,然后使用限制性更强的选择器来定义特定的添加/覆盖。

area{
/* matches all instances of the area element, so properties
that should be applied to all area elements go here */
}

#one {
/* properties which should only be applied to the element
with the ID "one" go here */
}

在原始问题的上下文中,这种技术通常用于减少必须声明的样式数量。如果 100 个 area 标签都需要相同的背景颜色,那么为每个标签都定义一个选择器是很愚蠢的。但是,可以定义其他选择器来覆盖该颜色和/或在某些元素上定义其他属性。

关于css - CSS 中的 sharedAttr 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16250961/

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