国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > CSS > 正文

CSS 英文教程 CSS語法

2024-07-11 08:38:25
字體:
供稿:網(wǎng)友

Syntax

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





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:





body {color:black}

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





p {font-family:”sans serif”}

Note: If you want 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:arial
}

Grouping

You can group selectors. Separate each selector with a comma. In the example below we have grouped all the header elements. All header elements will be displayed in green text color:





h1,h2,h3,h4,h5,h6
{
color:green
}

The class Selector

With the class selector you can define different styles for the same type of HTML element.


Say that you would like to have two types of paragraphs in your document: one right-aligned paragraph, and one center-aligned paragraph. Here is how you can do it with styles:





p.right {text-align:right}
p.center {text-align:center}

You have to use the class attribute in your HTML document:





<p class=”right”>This paragraph will be right-aligned.</p>
<p class=”center”>This paragraph will be center-aligned.</p>

Note: To apply more than one class per given element, the syntax is:





<p class=”center bold”>This is a paragraph.</p>
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 南投县| 柏乡县| 叶城县| 丹棱县| 泸水县| 牙克石市| 乾安县| 科技| 澄迈县| 祁连县| 师宗县| 金昌市| 景德镇市| 高雄县| 兖州市| 泰安市| 周口市| 文水县| 民乐县| 枝江市| 介休市| 阿鲁科尔沁旗| 桐城市| 百色市| 顺平县| 中江县| 利津县| 武安市| 道孚县| 岱山县| 英德市| 崇礼县| 怀远县| 湖南省| 册亨县| 西充县| 清新县| 永顺县| 开封市| 双城市| 满洲里市|