?? 005_css_syntax.html
字號:
<html>
<head>
<title>CCSS語法-CSS教程-網(wǎng)頁教程與代碼的中文站點-布啦布啦-blabla.cn</title>
<meta name="author" content="www.blabla.cn">
<meta name="keywords" content="CSS教程,css代碼, CSS語法,CSS屬性,,網(wǎng)頁教程和代碼的中文網(wǎng)站,網(wǎng)頁制作,源代碼,示例,布啦布拉,blabla.cn,examples">
<meta name="description" content="-網(wǎng)頁教程與代碼的中文站點-網(wǎng)頁制作-布啦布啦-blabla.cn">
<meta name="generator" content="blabla buildsite v2.0 - C:\CodeBank\BLABLA\blablasource\webtutorials\200_css\005_CSS_Syntax.txt">
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../styles/bla01.css" type="text/css">
<script type="text/javascript">
function WsFvt() {
window.external.addFavorite(
"../default.htm",
"布啦布啦網(wǎng)頁教程與代碼[www.blabla.cn]");
}
function WsHome() {
event.srcElement.style.behavior = "url(#default#homepage)";
event.srcElement.setHomePage("../default.htm");
}
function WsActOn() {
event.srcElement.className = "wsacton";
}
function WsAct() {
event.srcElement.className = "wsact";
}
</script>
</head>
<body class=wsbody>
<div class=wsheader>
<table cellpadding=0 cellspacing=0 class=wslogoarea>
<td class=ws_a1><img src="../images/logo/blabla_logo01.gif" class=blablalogo03></td>
<td class=ws_a2>
<div>
<font class=wsact onmouseover="WsActOn()" onmouseout="WsAct()" onclick="WsFvt()">加入收藏</font> |
<font class=wsact onmouseover="WsActOn()" onmouseout="WsAct()" onclick="WsHome()">設(shè)為首頁</font>|
<a href="mailto:webmaster@blabla.cn">聯(lián)系我們</a>
</div>
<div style = "height:20px;"></div>
<div>
<a href="../html_tutorials/index.html">HTML教程</a> |
<a href="../html_tutorials/100_html_examples.html">HTML示例代碼</a> |
<a href="index.html">CSS教程</a> |
<a href="100_CSS_examples.html">CSS示例代碼</a> |
<a href="../js_tutorials/index.html">Javascript教程</a> |
<a href="../js_tutorials/100_js_examples.html">Javascript示例代碼</a>
</div>
</td>
</tr></table>
</div>
<div class=wscontent>
<table cellpadding=0 cellspacing=0 class=wscgrid>
<td class=a1>
<div class=wsmenu><div class=box><div class=box>
<!--menupart Start -->
<a href = "../index.html"><H1>網(wǎng)站首頁</H1></a>
<a href = "../html_tutorials/index.html" ><H1>HTML網(wǎng)頁教程與代碼</H1></a><a href = "../html_tutorials/001_HTML_Overview.html" ><P>HTML基本概念</P></a><a href = "../html_tutorials/005_Basic_HTML_Tags.html" ><P>HTML基礎(chǔ)Tag</P></a><a href = "../html_tutorials/010_Format_Tags.html" ><P>HTML常用格式</P></a><a href = "../html_tutorials/015_HTML_entities.html" ><P>HTML特殊字符</P></a><a href = "../html_tutorials/020_HTML_links.html" ><P>HTML超鏈接(Hyperlinks)</P></a><a href = "../html_tutorials/022_html_path.html" ><P>HTML相對和絕對路徑</P></a><a href = "../html_tutorials/025_HTML_tables.html" ><P>HTML表格(Tables)</P></a><a href = "../html_tutorials/030_html_frame.html" ><P>HTML框架(Frames)</P></a><a href = "../html_tutorials/035_html_list.html" ><P>HTML列表(Lists)</P></a><a href = "../html_tutorials/037_html_form.html" ><P>HTML表單(Forms)</P></a><a href = "../html_tutorials/040_html_image.html" ><P>HTML圖片(Images)</P></a><a href = "../html_tutorials/042_html_font.html" ><P>HTML字體(Fonts)</P></a><a href = "../html_tutorials/045_html_bgcolor_background.html" ><P>HTML背景顏色和圖片</P></a><a href = "../html_tutorials/047_html_head.html" ><P>HTML頭部信息(Head)</P></a><a href = "../html_tutorials/050_html_color_ref.html" ><P>HTML顏色參考(Color)</P></a><a href = "../html_tutorials/100_html_examples.html" ><P>HTML演示示例代碼</P></a><a href = "../html_ref/index.html" ><H1>HTML參考(Reference)</H1></a><a href = "../html_tag_ref/index.html" ><P>HTML元素參考</P></a><a href = "../html_attr_ref/index.html" ><P>HTML屬性參考</P></a><a href = "index.html" ><H1>CSS教程和代碼</H1></a><a href = "001_CSS_Overview.html" ><P>CSS簡介</P></a><a href = "005_CSS_Syntax.html" ><P><B>CSS語法</B></P></a><a href = "010_css_font.html" ><P>CSS常用字體屬性(font)</P></a><a href = "015_css_text.html" ><P>CSS常用文本屬性</P></a><a href = "020_CSS_background.html" ><P>CSS常用背景屬性</P></a><a href = "025_css_border.html" ><P>CSS常用邊框?qū)傩?border)</P></a><a href = "030_css_margin.html" ><P>CSS邊距屬性(margin)</P></a><a href = "035_css_padding.html" ><P>CSS間隙屬性(padding)</P></a><a href = "040_css_diff_border_margin_padding.html" ><P>邊框/邊距/間隙的區(qū)別</P></a><a href = "045_css_list_style.html" ><P>CSS列表屬性(list-style)</P></a><a href = "050_pseudo_class.html" ><P>CSS常用偽類(pseudo-class)</P></a><a href = "060_css_length_unit.html" ><P>CSS長度單位參考</P></a><a href = "100_CSS_examples.html" ><P>CSS演示示例代碼</P></a><a href = "../js_tutorials/index.html" ><H1>Javascript教程和代碼</H1></a><a href = "../js_tutorials/001_js_overview.html" ><P>Javascript簡介</P></a><a href = "../js_tutorials/020_js_where2write.html" ><P>Javascript寫在哪里</P></a><a href = "../js_tutorials/025_js_variables.html" ><P>Javascript變量(Variables)</P></a><a href = "../js_tutorials/090_js_reserved_words.html" ><P>Javascript保留字</P></a><a href = "../js_tutorials/100_js_examples.html" ><P>Javascript入門代碼示例</P></a><a href = "../js_tutorials/101_js_dom_examples.html" ><P>Javascript DOM代碼示例</P></a><a href = "../ref/index.html" ><H1>參考(Reference)</H1></a><a href = "../ref/ascii.html" ><P>ASCII編碼表</P></a><a href = "../ref/iso_latin_1.html" ><P>ISO Latin-1字符集</P></a>
<!--menupart end -->
</div></div></div>
</td>
<td class=a2><div class=wsarticle><div class=articlepart id = ap>
<div class=wstitle><div class=box><div class=box><h1>CSS語法</h1></div></div></div>
<!--articlepart start-->
<div class = changefont>
<span onclick= "ap.className='ArticlePartBig';" class = bfont>大字體</span>
<span onclick= "ap.className='ArticlePart';" class = sfont>小字體</span>
</div>
<H2>基本語法</H2><P>一個樣式(Style)的語法由三部分構(gòu)成:Selector(中文叫選擇器有點怪怪的,就用英文吧),屬性(Property),屬性值(Value)。</P><PRE>selector {property: value}</PRE><P>舉個例子,下面的代碼p就是selector,color就是屬性,blue就是屬性值。</P><PRE>p {color:blue}</PRE><P>HTML中所有的Tag都可以作為selector。</P><P><STRONG>注:如果你想為Style加多個屬性,在兩個屬性之間要用分號加以分隔。</STRONG>下面的Style就包含2個屬性,一個是對齊方式居中,一個字體顏色為紅,當中用分號分隔開。</P><PRE>p {text-align:center;color:red} </PRE><P>為了提高Style代碼的可讀性,你也可以分行寫:</P><PRE>p</PRE><PRE>{</PRE><PRE>text-align: center;</PRE><PRE>color: black;</PRE><PRE>font-family: arial</PRE><PRE>} </PRE><H2>組合(Grouping)</H2><P>你也可以將相同的屬性和屬性值賦予多個Selector。<STRONG>Selector之間用逗號分隔</STRONG>。</P><PRE>h1,h2,h3,h4,h5,h6 </PRE><PRE>{</PRE><PRE>color: red</PRE><PRE>}</PRE><P>上面的例子是將所有正文標題(<h1>到<h6>)的字體顏色都變成紅色。</P><H2>Class Selector</H2><P>利用Class Selector,你可以用同樣的HTML Tag構(gòu)成不同的樣式。比如說,你希望段落<p>有兩種樣式,一種是居中對齊,一種是居右對齊。你就可以寫如下樣式:</P><PRE>p.right {text-align:right}</PRE><PRE>p.center {text-align:center}</PRE><P>其中right和center就是兩個class。然后你就可以引用這兩個class,示例代碼如下:</P><PRE><p class="center">這一段居中顯示。</p></PRE><PRE><p class="right">這一段是居右顯示。</p></PRE><P><A href="../css_examples/005_class_selector.html">演示示例</A></P><P>你也可以不用HTML Tag,直接用.加上Class名稱作為一個Selector。示例代碼如下:</P><PRE>.center {text-align: center} </PRE><P>這種通用的Class Selector就沒有Tag的局限性,可以用于不同的Tag。比如:</P><PRE><h1 class = "center">這個標題居中顯示。</h1></PRE><PRE><p class = "center">這個段落居中顯示。</p></PRE><P><A href="../css_examples/004_class_selector_generic.html">演示示例</A></P><H2>Contextual Selector</H2><P>你可以為嵌入其它Tag的Tag定義樣式,示例代碼如下:</P><PRE>p em{color: red}</PRE><P>Em這個Tag嵌套在P里面。p em就叫做Contextual Selector,定義嵌套于P里的Em的樣式。這個例子表示,在P里面的用Em這個Tag標記的字體顏色是紅色。</P><P><A href="../css_examples/006_contextual_selector.html">演示示例</A></P><H2>CSS注釋</H2><P>為了方便你自己或者他人日后更好地理解你的CSS代碼,你可以寫CSS代碼注釋。CSS代碼注釋以/*開頭,以*/結(jié)束。</P><PRE>/* 段落樣式 */</PRE><PRE>p</PRE><PRE>{</PRE><PRE>text-align: center;</PRE><PRE>/* 居中顯示 */</PRE><PRE>color: black;</PRE><PRE>font-family: arial</PRE><PRE>} </PRE><P> </P>
<!--articlepart end-->
</div><div></td>
<td class=a3><div class=wslink>
<div class=wsportrait>
<img src="../images/logo/blabla_logo02.gif" class=blablalogo21>
</div>
<div class=wslgreen><div class=box><div class=box>
<h2>布啦布啦旗下網(wǎng)站</h2>
<p><a href="../index.html">布啦布啦網(wǎng)頁教程與代碼</a></p>
<p><a href="http://www.wowstory.com">小斧的魔獸世界</a></p>
<p><a href="../wow/index.html">小斧的魔獸世界鏡像</a></p>
<p><a href="http://hardware.blabla.cn">數(shù)碼資訊</a></p>
</div></div></div>
<div style= "background-color:#FFFFF0;
border-top:3px solid #FFCC66; border-bottom:3px solid #FFCC66;border-left:1px solid #FFE0A1;border-right:1px solid #FFE0A1;">
<!-- SiteSearch Google -->
<form method="get" action="http://www.google.com/custom" target="_top">
<table border="0" bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
</td>
<td nowrap="nowrap">
<input type="hidden" name="domains" value="blabla.cn"></input>
<input type="text" name="q" size="18" maxlength="255" value=""></input>
</td></tr>
<tr>
<td> </td>
<td nowrap="nowrap">
<table>
<tr>
<td>
<input type="radio" name="sitesearch" value=""></input>
<font size="-1" color="#000000" style = "font-size:12px;">Web</font>
</td>
<td>
<input type="radio" name="sitesearch" value="blabla.cn" checked="checked"></input>
<font size="-1" color="#000000" style = "font-size:12px;">blabla.cn</font>
</td>
</tr>
</table>
<input type="submit" name="sa" value="Google 搜索"></input>
<input type="hidden" name="client" value="pub-3105632846497229"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="ie" value="GB2312"></input>
<input type="hidden" name="oe" value="GB2312"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1;"></input>
<input type="hidden" name="hl" value="zh-CN"></input>
</td></tr></table>
</form>
<!-- SiteSearch Google -->
</div>
<div style ="height:8px;font-size:8px;"></div>
<!--Google Adsense start-->
<div id="googlead" style = "width:160px; height:600px;" ></div>
<!--Google Adsense end-->
</div>
</td></tr>
</table></div>
<div class=wsfooter>
<table cellpadding=0 cellspacing=0 class=wsgrid>
<tr><td class=ws_a1>
<!--footer label start-->
© 2005 blabla.cn版權(quán)所有
<!--51yes statistics start-->
<script language="javascript" src="http://count1.51yes.com/click.aspx?id=13420718&logo=12"></script>
<!--51yes statistics end-->
</td></tr></table>
</div>
<!--Google Ad Script Start -->
<div id="googleadcode" style="display:none;">
<script type="text/javascript"><!--
google_ad_client = "pub-3105632846497229";
google_alternate_color = "FFFFFF";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "A8C8FF";
google_color_bg = "F5F9FF";
google_color_link = "0058DB";
google_color_url = "008000";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<script language="javascript">
if(document.all.item("googlead") != null)
{
googlead.innerHTML = googleadcode.innerHTML;
}
</script>
<!--Google Ad Script End-->
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -