css教程:CSS语法(CSS Syntax)

css教程:CSS语法(CSS Syntax)

CSS Syntax:

CSS语法

The CSS syntax is made up of three parts: a selector, a property and a value:

CSS的语法由三部分组成: 一个选择器,一个属性和一个值:

selector {property: value}

The selector is normally the HTML element/tag you wish to define, the property is the attribute you wish to change, and each property can take a value. The property and value are separated by a colon, and surrounded by curly braces:

选择器是你希望去定义的HTML元素/标签,改变属性,每个属性可以有一个值,属性和值由冒号区分开外面用大括号括起来:

body {color: black}

Note: If    the value is multiple words, put quotes around the value:

注意:如果值为多个单词则用双引号括起来:

p {font-family: “sans serif”}

Note: If you wish to specify more than one property, you must separate each property with a semicolon. The example below shows how to define a center aligned paragraph, with a red text color:

注意:如果你想指定多个属性,你就必须将每个属性用分号隔开,下面的例子就演示了怎样定义居中红色文字段落:

p {text-align:center;color:red}

To make the style definitions more readable, you can describe one property on each line, like this:

为了让样式定义更有可读性,你可以像这样分行描述属性:

p

{

text-align: center;

color: black;

font-family: aria

l}

Grouping

第 1 2 3 4 页

css教程:CSS语法(CSS Syntax)

相关文章:

你感兴趣的文章:

标签云: