css property可以包含下列这些属性:

  • Value: legal values & syntax

  • Initial: initial value

  • Applies to: elements this property applies to

  • Inherited: whether the property is inherited

  • Percentages: how percentage values are interpreted - 是否接受百分号作为属性值

  • Media: which media groups the property applies to

  • Computed value: how to compute the computed value

属性值定义的几种方式:

  • Several juxtaposed words mean that all of them must occur, in the given order.

  • A bar (|) separates two or more alternatives: exactly one of them must occur.

  • A double bar (||) separates two or more options: one or more of them must occur, in any order.

  • A double ampersand (&&) separates two or more components, all of which must occur, in any order.

  • Brackets ([ ]) are for grouping.


font-family: "Gill Sans", sans-serif; - 通用字体,所有浏览器都支持

User Agent, 即浏览器。

The first declaration on the BODY element sets the font family to “Gill Sans”. If that font is not available, the user agent (often referred to as a “browser”) will use the ‘sans-serif’ font family which is one of five generic font families which all users agents know. Child elements of BODY will inherit the value of the ‘font-family’ property.

Attribute

A value associated with an element, consisting of a name, and an associated (textual) value.

Content

The content associated with an element in the source document. Some elements have no content, in which case they are called empty.

The content of an element may include text, and it may include a number of sub-elements, in which case the element is called the parent of those sub-elements.

Author

An author is a person who writes documents and associated style sheets. An authoring tool is a User Agent that generates style sheets.

css的书写者。

User

A user is a person who interacts with a user agent to view, hear, or otherwise use a document and its associated style sheet. The user may provide a personal style sheet that encodes personal preferences.

最终用户

User agent (UA)

A user agent is any program that interprets a document written in the document language and applies associated style sheets according to the terms of this specification. A user agent may display a document, read it aloud, cause it to be printed, convert it to another format, etc.

An HTML user agent is one that supports one or more of the HTML specifications. A user agent that supports XHTML [XHTML], but not HTML is not considered an HTML user agent for the purpose of conformance with this specification.

Property

CSS defines a finite set of parameters, called properties, that direct the rendering of a document.

Each property has a name (e.g., ‘color’, ‘font’, or border’) and a value (e.g., ‘red’, ‘12pt Times’, or ‘dotted’). Properties are attached to various parts of the document and to the page on which the document is to be displayed by the mechanisms of specificity, cascading, and inheritance (see the chapter on Assigning property values, Cascading, and Inheritance).

CSS property和document渲染相关,但attribute无关。

看个attribute的例子:


<html><div><span>1</span><span>2</span></div><div id = "jerry" actions tool="spa"><p>3</p><p>4</p></div></html>

percentage property

Percentage values are always relative to another value, for example a length.

Percentage values总是和另一个属性值相关联。

Each property that allows percentages also defines the value to which the percentage refers. The value may be that of another property for the same element, a property for an ancestor element, or a value of the formatting context (e.g., the width of a containing block).

比如我指定了一个max-wdith:60%,那么这个60%到底是另一个什么样的属性的60%呢?

另一个属性可能是同一个element的另一个属性,也可能是其祖先element的某一个属性,或者是formatting context的value,比如containing block的width.

When a percentage value is set for a property of the root element and the percentage is defined as referring to the inherited value of some property, the resultant value is the percentage times the initial value of that property.

percentage value的继承问题

Since child elements (generally) inherit the computed values of their parent, in the following example, the children of the P element will inherit a value of 12px for ‘line-height’, not the percentage value (120%):


p { font-size: 10px }p { line-height: 120% } /* 120% of 'font-size' */

子节点继承父节点的property是calculated property,而不是percentage property.

css property 和 attribute 的区别相关推荐

  1. HTML property 和 attribute 的区别

    前端编程里,property 和 attribute 是一对极容易混淆的术语. Angular 的属性绑定语法: <img [src]="itemImageUrl"> ...

  2. DOM中Property与Attribute的区别

    property和attribute的汉语翻译几乎相同,都有"属性"的意义(这里姑且称attribute为"特性",以方便区分),而他们的取值也经常相同,但有时 ...

  3. JavaScript 中 Property 和 Attribute 的区别

    转自:http://www.cnblogs.com/elcarim5efil/p/4698980.html property 和 attribute非常容易混淆,两个单词的中文翻译也都非常相近(pro ...

  4. Property 和 Attribute 的区别(转)

    property 和 attribute非常容易混淆,两个单词的中文翻译也都非常相近(property:属性,attribute:特性),但实际上,二者是不同的东西,属于不同的范畴. property ...

  5. C#中Property和Attribute的区别

    Attribute 字段 Property 属性(get;set;) 属性的正常写: private string name; public string Name { get { return na ...

  6. property和attribute的区别

    property是指类向外提供的数据区域. 而attribute则是描述对象在编译时或运行时属性的,分为固有型和用户自定义型,其中用户自定义型可以利用Reflection在运行期获取. 这两者是有本质 ...

  7. 一个简单的例子学习 HTML 元素property和attribute的区别

    源代码: <html> <style> </style><button disabled>Click</button> <button ...

  8. 【译】详解HTML中property和attribute的区别

    翻看Vue API文档时发现v-bind有一个修饰符.prop比较特殊: .prop - 作为一个 DOM property 绑定而不是作为 attribute 绑定. 文档还给了一个stack ov ...

  9. 区别C#中的两个属性(Property和Attribute)

    区别C#中的两个属性(Property和Attribute) 在C#中有两个属性,分别为Property和Attribute,两个的中文意思都有特性.属性之间,但是用法上却不一样,为了区别,本文暂把P ...

最新文章

  1. Ribbon For WPF的使用
  2. can差分线阻抗_CAN总线冷知识—边沿台阶是怎么来的?
  3. [专栏目录]-optee/TEE/TA笔记-目录
  4. Apache Superset从入门到放弃(基于python3.6.9)
  5. jzoj3845-简单题【dp】
  6. animate.css动画样式详解
  7. 苹果笔记本电脑进入新时代
  8. Android笔记 activity生命周期 Tasks and back stack回退栈
  9. mysql架构 三级主从同步_MySQL 主从同步架构中你不知道的“坑”
  10. 小清新风高清壁纸,让你一天心情轻松!
  11. nvidia-smi每0.1s实时显示显存使用情况,且数字变化处有白底
  12. 变分自编码器(VAE)详解与实现(tensorflow2.x)
  13. go语言学习之helloword
  14. 软件众包,哪个数据库好
  15. 初学ASP.Net时在论坛收藏收集的一些资料备忘
  16. 人工智能-八数码问题-启发式搜索
  17. 论文解读:A Hierarchical Framework for Relation Extraction with Reinforcement Learning
  18. 如何使用帆软BI直接分析明道云数据
  19. Python 基础(二)[列表,字典,文件操作]
  20. 滑动窗口(最大最小值)的经典例题

热门文章

  1. ASP.NET MVC控制器获取前端视图FORM表单的方法
  2. HDCMS导航高亮显示!解决办法
  3. response.getWriter()和jsp中out对象的区别
  4. spinner的理解
  5. 在ExtJS的ComboBox组件中实现下拉树效果
  6. 搭建Eclipse C++开发环境
  7. Enums and Structs in C#(C#里的枚举和结构) (from codeproject)
  8. MyEclipse 清理项目缓存的几大方法
  9. 【转】python装饰器
  10. 初涉网络流 POJ 1459 Power Network