名词“样式”(复数“样式”)在 CSS 上下文中的确切含义是什么?
我看过一些术语/词汇表页面,但它们似乎没有涵盖这个词:
- https://css-tricks.com/css-ruleset-terminology/
- http://nimbupani.com/css-vocabulary.html
- https://www.impressivewebs.com/css-terms-definitions/
- https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax
- https://www.hongkiat.com/blog/css-back-to-basics-terminology-explained/
- https://www.codecademy.com/articles/glossary-css
这是一个术语定义的例子,这正是我要找的:
选择器
选择器是 CSS 行的一部分,它选择要使用属性/值对定位的元素。在下面的示例中,“#container #box”是选择器:
/* the selector is everything on the first line */
/* excluding the opening curly brace */
#container #box {
width: 200px;
}
最佳答案
我得到的最接近答案的是“样式”指的是声明:
.a {
/*┏━━━━━ Style aka Declaration ━━━━━━┓ */
background-color: mediumspringgreen;
}
因此“样式”指的是多个声明。
我基于口语用法:
Property: The style that you are applying to a selector, e.g. border.
Selector: The way you declare which elements the styles should apply to.
引用:http://nimbupani.com/css-vocabulary.html
an element that has a class of “navigation” will receive the declared styles.
引用:https://www.impressivewebs.com/css-terms-definitions/
div[attrib^="1"] { /* styles here */ }
引用:https://www.hongkiat.com/blog/css-back-to-basics-terminology-explained/
另一种定义似乎是指“文档样式”或“全局样式”,如 the CSS1 Spec ,虽然这并不常见:
CSS1 is a simple style sheet mechanism that allows authors and readers to attach style (e.g. fonts, colors and spacing) to HTML documents.
关于css - CSS中名词 "style"的定义是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57397362/