css - CSS中名词 "style"的定义是什么?

标签 css terminology

名词“样式”(复数“样式”)在 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/

相关文章:

javascript - 使用 jQuery 在 Bootstrap Carousel 中的同一张幻灯片上显示多个元素

html - 使用rowspan后如何显示行底边框?

terminology - 什么是领域特定语言?有人用吗?又以什么方式呢?

c++ - 为什么两个不同的概念都称为 "heap"?

javascript - 如何使这个 slider 脚本能够显示准确的图像宽度和高度

html - 仅使用 HTML 和 CSS 创建交互式条形图

html - 防止 float 换行并在需要时强制文本溢出

class - 对于只包含数据而不包含逻辑的类,是否有标准术语?

c++ - '...' token 的正确术语是什么?

oop - 术语 WRAPPER 在编程中的使用位置和方式,它有什么帮助?