CSS术语:这些叫做什么? [英] CSS terminology: what are these called?

查看:48
本文介绍了CSS术语:这些叫做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑:


p {
  ...
}

.foo {
  ...
}

#bar {
  ...
}

CSS中这些语句的正确名称是什么?我见过它们称为选择器,规则或规则集,但这是正确的吗?

What is the correct name for these statements in CSS? I've seen them called selectors, rules or rulesets, but which is correct?

推荐答案

将考虑一个规则:

p {…}

在这种情况下为选择器是:

A selector in this case is:

p

选择器和声明。声明为 property:value ,因此整个规则为:

A rule is made up of selectors and declarations. A declaration is property:value so the entire rule would be:

selector {属性:value}

一个规则可以有多个声明和多个选择器,因此我们实际上可以拥有:

A rule can have multiple declarations and multiple selectors so we can actually have:

selector, selector2
{
  property:value;
  property2:value;
} 

一个规则集将是多个规则。

A rule set would be multiple rules.

这里有一个快速的,或者 CSS 1规范

Here's a quick source on this or the CSS 1 Specification.

这篇关于CSS术语:这些叫做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆