亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 開發 > CSS > 正文

CSS英文教程:CSS語法

2024-07-11 09:03:55
字體:
來源:轉載
供稿:網友

武林網(www.49028c.com)文章簡介:CSS英文教程:CSS語法:Syntax.

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>

The paragraph above will be styled by the class "center" AND the class "bold".

You can also omit the tag name in the selector to define a style that will be used by all HTML elements that have a certain class. In the example below, all HTML elements with class="center" will be center-aligned:

.center {text-align:center}

In the code below both the h1 element and the p element have class="center". This means that both elements will follow the rules in the ".center" selector:

<h1 class="center">This heading will be center-aligned</h1>
<p class="center">This paragraph will also be center-aligned.</p>

Do NOT start a class name with a number! This is only supported in Internet Explorer.

Add Styles to Elements with Particular Attributes

You can also apply styles to HTML elements with particular attributes.

The style rule below will match all input elements that have a type attribute with a value of "text":

input[type="text"] {background-color:blue}


The id Selector

You can also define styles for HTML elements with the id selector. The id selector is defined as a #.

The style rule below will match the element that has an id attribute with a value of "green":

#green {color:green}

The style rule below will match the p element that has an id with a value of "para1":

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

 Do NOT start an ID name with a number! It will not work in Mozilla/Firefox.

CSS Comments

Comments are used to explain your code, and may help you when you edit the source code at a later date. A comment will be ignored by browsers. A CSS comment begins with "/*", and ends with "*/", like this:

/*This is a comment*/
p
{
text-align:center;
/*This is another comment*/
color:black;
font-family:arial
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
51视频国产精品一区二区| 国产精品美乳一区二区免费| 国产精品久久久久久久久久久久久久| 亚洲欧美综合区自拍另类| 国产精品第3页| 欧美激情视频在线免费观看 欧美视频免费一| 亚洲伊人久久大香线蕉av| 欧美中文字幕第一页| 日韩在线不卡视频| 国产91|九色| 久久久成人精品视频| 91久久精品视频| 91久久在线播放| 亚洲天堂av电影| 午夜精品在线观看| 欧洲美女免费图片一区| 欧美一级大片在线观看| 深夜成人在线观看| 国产丝袜一区二区三区免费视频| 国语自产精品视频在线看| 亚洲欧美中文日韩v在线观看| 精品美女国产在线| 亚洲qvod图片区电影| 美女精品久久久| 欧美精品激情在线观看| 欧美日韩一区二区免费视频| 伊人精品在线观看| 国产精品欧美亚洲777777| 欧美国产日韩中文字幕在线| 久久在线视频在线| 成人精品久久久| 欧美成人精品在线观看| 久久久免费精品| 日韩av中文在线| 亚洲国产女人aaa毛片在线| 国产精品久久久久久久久久久久| 91精品久久久久久久久久久| 日本精品在线视频| 日韩欧美亚洲范冰冰与中字| 久久亚洲国产精品| 久久久亚洲国产| 久久久久久久一| 亚洲人午夜精品| 欧美性猛交xxxx乱大交蜜桃| 欧美精品久久久久| 69久久夜色精品国产69| 亚洲色图五月天| 日韩在线视频观看| 性欧美xxxx交| 亚洲精品乱码久久久久久按摩观| 欧美日韩国产中文字幕| 亚洲综合日韩中文字幕v在线| 日韩欧美aaa| 国产综合福利在线| 亚洲欧洲偷拍精品| 国产精品美女www爽爽爽视频| 欧美日韩午夜视频在线观看| 国产成人精品免高潮在线观看| 69**夜色精品国产69乱| 久久精品亚洲精品| 一区二区三区天堂av| 亚洲成人国产精品| 国产视频欧美视频| 欧美xxxx做受欧美| 亚洲福利视频网站| 91精品在线观看视频| 日韩av电影在线免费播放| 亚洲自拍偷拍色图| 17婷婷久久www| 人人做人人澡人人爽欧美| 国产精品日日摸夜夜添夜夜av| 国产午夜精品理论片a级探花| 亚洲免费视频观看| 久久久伊人欧美| 日本一欧美一欧美一亚洲视频| 视频一区视频二区国产精品| 国产精品爱啪在线线免费观看| 亚洲成人激情图| 91成人精品网站| 色综合天天综合网国产成人网| 精品久久久91| 欧美久久精品一级黑人c片| 97av在线播放| 国产精品视频精品视频| 欧美日韩中国免费专区在线看| 欧美性受xxxx白人性爽| 国产区精品在线观看| 国自产精品手机在线观看视频| 91国偷自产一区二区三区的观看方式| 91啪国产在线| 97久久超碰福利国产精品…| 91视频8mav| 自拍视频国产精品| 欧美午夜美女看片| 高清一区二区三区日本久| 国产精品久久久久影院日本| 成人国产精品日本在线| 欧美视频不卡中文| 26uuu日韩精品一区二区| 国产亚洲精品激情久久| 亚洲最新av在线| 日韩激情第一页| 亚洲图片在区色| 国产精品免费网站| www.亚洲人.com| 国产精品女主播视频| 夜夜嗨av色一区二区不卡| 国产丝袜视频一区| 欧美老少配视频| 欧美久久精品一级黑人c片| 欧美成人黄色小视频| 欧美日韩国产精品| 97人人做人人爱| 成人xxxxx| 色综合久久天天综线观看| 91视频8mav| 一区二区三区www| 亚洲在线观看视频网站| 69av成年福利视频| 成人黄色影片在线| 日本精品va在线观看| 欧美日韩国产专区| 国产精品久久久久久久久久免费| 亚洲影视中文字幕| 国内精品美女av在线播放| 日韩美女视频中文字幕| 日韩中文字幕网站| 久久99亚洲精品| 亚洲视频自拍偷拍| 综合136福利视频在线| 亚洲国产精品免费| 国产成人综合久久| 亚洲国产欧美一区| 成人日韩在线电影| 久久精品国产亚洲7777| 国内外成人免费激情在线视频网站| 成人在线视频福利| 国产自产女人91一区在线观看| 久久久97精品| 中文综合在线观看| 精品美女久久久久久免费| 一个人www欧美| 亚洲精品福利资源站| 在线观看亚洲视频| 国产成人高清激情视频在线观看| 国产精品久久久久久亚洲影视| 欧美极品少妇xxxxⅹ裸体艺术| 日韩免费在线播放| 久久欧美在线电影| 综合136福利视频在线| 久久99久久久久久久噜噜| 亚洲成色777777在线观看影院| 一区二区福利视频| 亚洲xxx自由成熟| 国产91精品黑色丝袜高跟鞋| 亚洲风情亚aⅴ在线发布| 久久久91精品国产| 欧美激情欧美激情在线五月| 日韩va亚洲va欧洲va国产| 国产精品夫妻激情| 日韩中文字幕网| 久久男人资源视频| 久久国产精品久久久久| 亚洲免费小视频|