shù > css yàng shì biǎo
目录
No. 1
  shénme shì yàng shì biǎo
  css shì cascadingstylesheet de suō xiě zuò céng dié yàng shì biǎo dān shì yòng zēng qiángkòng zhì wǎng yàng shì bìng yǔn jiāng yàng shì xìn wǎng nèi róng fēn de zhǒng biāo xìng yán
   jiāng yàng shì biǎo jiā nín de wǎng
   yòng xià sān zhǒng fāng shì jiāng yàng shì biǎo jiā nín de wǎng ér zuì jiē jìn biāo de yàng shì dìng yōu xiān quán yuè gāogāo yōu xiān quán yàng shì jiāng chéng yōu xiān quán yàng shì de wèi chóngdié dìng dàn gài chóngdié de dìng wài qǐng cān yuè important shēng míng
   liàn wài yàng shì biǎo wén jiàn (linkingtoastylesheet)
   xiān jiàn wài yàng shì biǎo wén jiàn( .css), rán hòu shǐ yòng html de link duì xiàngshì xià
  <head>
  <title>titleofarticle</title>
  <linkrel=stylesheethref="http://www.dhtmlet.com/rainer.css"type="text/css">
  </head>
   ér zài xml zhōng yīnggāi xià suǒ shì zài shēng míng zhōng jiā
  <?xml-stylesheettype="text/css"href="http://www.dhtmlet.com/rainer.css"?>>
   dìng nèi yàng shì kuài duì xiàng (embeddingastyleblock)
   zài de html wén dàng de <html> <body> biāo zhī jiān chā <style>...</style> kuài duì xiàngdìng fāng shì qǐng cān yuè yàng shì biǎo shì xià
  <html>
  <styletype="text/css">
  <!--
  body{font:10pt"arial"}
  h1{font:15pt/17pt"arial";font-weight:bold;color:maroon}
  h2{font:13pt/15pt"arial";font-weight:bold;color:blue}
  p{font:10pt/12pt"arial";color:black}
  -->
  </style>
  <body>
   qǐng zhù zhè jiāng style duì xiàng de type shǔ xìng shè zhì wéi "text/css", shì yǔn zhī chí zhè lèi xíng de liú lǎn lüè yàng shì biǎo dān
   nèi lián dìng (inlinestyles)
   nèi lián dìng shì zài duì xiàng de biāo nèi shǐ yòng duì xiàng de style shǔ xìng dìng shì yòng de yàng shì biǎo shǔ xìngshì xià
  <pstyle="margin-left:0.5in;margin-right:0.5in"> zhèyīháng bèi zēng jiā liǎo zuǒ yòu de wài dīng <p>
   yàng shì biǎo (csssyntax)
  _select_or{property:value}
   cān shù shuō míng
  _select_or-- xuǎn
  property:value-- yàng shì biǎo dìng shǔ xìng shǔ xìng zhí zhī jiān yòng mào hào (:) kāidìng zhī jiān yòng fēn hào (;) kāi
   chéng de zhí (the'inherit'value)
   měi shǔ xìng dōuyòu zhǐ dìng de zhí: inherit。 de shìjiāng duì xiàng de zhí děng tóng wéi suàn zhí dàozhè zhí tōng cháng jǐn jǐn shì bèi yòng dexiǎn shì de shēng míng yòng lái qiáng diào
   xuǎn shuō míng
  # biǎo shì xuǎn id
  . biǎo shì xuǎn class
   yòu <divid="test"></div> zhè shí jiù yòng #test{ shǔ xìng } lái gěi id wéi test de div lái zhì dìng yàng shì
   ér <divclass="test"></div> yīnggāi yòng .test{ shǔ xìng } lái gěi zhǐ dìng yàng shì
No. 2
  shénme shì yàng shì biǎo
  css shì cascadingstylesheet de suō xiě zuòcéng dié yàng shì biǎo dān」。 shì yòng zēng qiángkòng zhì wǎng yàng shì bìng yǔn jiāng yàng shì xìn wǎng nèi róng fēn de zhǒng biāo xìng yán
   jiāng yàng shì biǎo jiā nín de wǎng
   yòng xià sān zhǒng fāng shì jiāng yàng shì biǎo jiā nín de wǎng ér zuì jiē jìn biāo de yàng shì dìng yōu xiān quán yuè gāogāo yōu xiān quán yàng shì jiāng chéng yōu xiān quán yàng shì de wèi chóngdié dìng dàn gài chóngdié de dìng wài qǐng cān yuè important shēng míng
   liàn wài yàng shì biǎo wén jiàn (linkingtoastylesheet)
   xiān jiàn wài yàng shì biǎo wén jiàn( .css), rán hòu shǐ yòng html de link duì xiàngshì xià
  <head>
  <title>titleofarticle</title>
  <linkrel=stylesheethref="http://www.dhtmlet.com/rainer.css"type="text/css">
  </head>
   ér zài xml zhōng yīnggāi xià suǒ shì zài shēng míng zhōng jiā
  <?xml-stylesheettype="text/css"href="http://www.dhtmlet.com/rainer.css"?>>
   dìng nèi yàng shì kuài duì xiàng (embeddingastyleblock)
   zài de html wén dàng de <html> <body> biāo zhī jiān chā <style>...</style> kuài duì xiàngdìng fāng shì qǐng cān yuè yàng shì biǎo shì xià
  <html>
  <styletype="text/css">
  <!--
  body{font:10pt"arial"}
  h1{font:15pt/17pt"arial";font-weight:bold;color:maroon}
  h2{font:13pt/15pt"arial";font-weight:bold;color:blue}
  p{font:10pt/12pt"arial";color:black}
  -->
  </style>
  <body>
   qǐng zhù zhè jiāng style duì xiàng de type shǔ xìng shè zhì wéi "text/css", shì yǔn zhī chí zhè lèi xíng de liú lǎn lüè yàng shì biǎo dān
   nèi lián dìng (inlinestyles)
   nèi lián dìng shì zài duì xiàng de biāo nèi shǐ yòng duì xiàng de style shǔ xìng dìng shì yòng de yàng shì biǎo shǔ xìngshì xià
  <pstyle="margin-left:0.5in;margin-right:0.5in"> zhèyīháng bèi zēng jiā liǎo zuǒ yòu de wài dīng <p>
   yàng shì biǎo (csssyntax)
  _select_or{property:value}
   cān shù shuō míng
  _select_or-- xuǎn
  property:value-- yàng shì biǎo dìng shǔ xìng shǔ xìng zhí zhī jiān yòng mào hào (:) kāidìng zhī jiān yòng fēn hào (;) kāi
   chéng de zhí (the'inherit'value)
   měi shǔ xìng dōuyòu zhǐ dìng de zhí: inherit。 de shìjiāng duì xiàng de zhí děng tóng wéi suàn zhí dàozhè zhí tōng cháng jǐn jǐn shì bèi yòng dexiǎn shì de shēng míng yòng lái qiáng diào
   xuǎn shuō míng
  # biǎo shì xuǎn id
  . biǎo shì xuǎn class
   yòu <divid="test"></div> zhè shí jiù yòng #test{ shǔ xìng } lái gěi id wéi test de div lái zhì dìng yàng shì
   ér <divclass="test"></div> yīnggāi yòng .test{ shǔ xìng } lái gěi zhǐ dìng yàng shì
   gēn fēn biàn shuài tóngdiào yòng tóng de css wén jiàn
  dotted;table-layout:fixed;border-top:#cccccc1pxdotted;border-left:#cccccc1pxdotted;border-bottom:#cccccc1pxdotted"cellspacing=0cellpadding=6width="95%"align=centerborder=0><scriptlanguage="javascript">
  <!--
  if(window.navigator.useragent.indexof("msie")>=1)
  {
  varie1024="";
  varie800="";
  varie1152="";
  varieother="";
  screenwidth(ie1024,ie800,ie1152,ieother)
  }else{
  if(window.navigator.useragent.indexof("firefox")>=1)
  {
  file:// guǒ liú lǎn wéi firefox
  varfirefox1024="";
  varfirefox800="";
  varfirefox1152="";
  varfirefoxother="";
  screenwidth(firefox1024,firefox800,firefox1152,firefoxother)
  }else{
  file:// guǒ liú lǎn wéi
  varother1024="";
  varother800="";
  varother1152="";
  varotherother="";
  screenwidth(other1024,other800,other1152,otherother)
  }
  }
  functionscreenwidth(css1,css2,css3,css4){
  if((screen.width==1024)&&(screen.height==768)){
  setactivestylesheet(css1);
  }else{
  if((screen.width==800)&&(screen.height==600)){
  setactivestylesheet(css2);
  }else{
  if((screen.width==1152)&&(screen.height==864)){
  setactivestylesheet(css3);
  }else{
  setactivestylesheet(css4);
  }}}
  }
  functionsetactivestylesheet(title){
  document.getelementsbytagname("link")[0].href="style/"+title;
  }
  file://-->
  </script>
   jiě shì
  varie1024="";
  varie800="";
  varie1152="";
  varieother="";
   yǐn hào miàn fēn bié tián xiěyòng shǐ yòng ie de shí hòu bìng qiě fēn biàn shuài wéi 1024*768,800*600,1152*864 yào shǐ yòng de css wén jiàn míng .
  varfirefox1024="";
  varfirefox800="";
  varfirefox1152="";
  varfirefoxother="";
   yǐn hào miàn fēn bié tián xiěyòng shǐ yòng ff de shí hòu bìng qiě fēn biàn shuài wéi 1024*768,800*600,1152*864 yào shǐ yòng de css wén jiàn míng .
  varother1024="";
  varother800="";
  varother1152="";
  varotherother="";
   yǐn hào miàn fēn bié tián xiěyòng shǐ yòng liú lǎn de shí hòu bìng qiě fēn biàn shuài wéi 1024*768,800*600,1152*864 yào shǐ yòng de css wén jiàn míng .
   pàn duàn fēn biàn shuàizhǐ pàn duàn liú lǎn
   yìng e.qiang biān xià dài shí xiàn gēn liú lǎn lèi xíng dòng diào yòng tóng css。
   dài
  <scriptlanguage="javascript">
  <!--
  if(window.navigator.useragent.indexof("msie")>=1)
  {
  file:// guǒ liú lǎn wéi ie
  setactivestylesheet("default.css");
  }else{
  if(window.navigator.useragent.indexof("firefox")>=1)
  {
  file:// guǒ liú lǎn wéi firefox
  setactivestylesheet("default2.css");
  }else{
  file:// guǒ liú lǎn wéi
  setactivestylesheet("newsky.css");
  }
  }
  functionsetactivestylesheet(title){
  document.getelementsbytagname("link")[0].href="style/"+title;
  }
  file://-->
  </script>
   jiě shì
   guǒ liú lǎn wéi ie, diào yòng default.css
   guǒ liú lǎn wéi firefox, diào yòng default2.css
   guǒ liú lǎn wéi diào yòng newsky.css
   yòng fàng zài <head></head> zhōng
shénme shì yàng shì biǎo
  CSS shì Cascading Style Sheet de suō xiě zuòcéng dié yàng shì biǎo dān」。 shì yòng zēng qiángkòng zhì wǎng yàng shì bìng yǔn jiāng yàng shì xìn wǎng nèi róng fēn de zhǒng biāo xìng yán
   yàng shì biǎo (CSS: CascadingStyleSheets) xué
  http://www.cssplay.org.cn/css-tutorial/20080324/319.html
jiāng yàng shì biǎo jiā nín de wǎng
   yòng xià sān zhǒng fāng shì jiāng yàng shì biǎo jiā nín de wǎng ér zuì jiē jìn biāo de yàng shì dìng yōu xiān quán yuè gāogāo yōu xiān quán yàng shì jiāng chéng yōu xiān quán yàng shì de wèi chóngdié dìng dàn gài chóngdié de dìng wài qǐng cān yuè important shēng míng
   jiāng yàng shì biǎo jiā dào HTML zhōng
  http://www.cssplay.org.cn/css-tutorial/20080128/2.html
   liàn wài yàng shì biǎo wén jiàn (LinkingtoaStyleSheet)
   xiān jiàn wài yàng shì biǎo wén jiàn( .css), rán hòu shǐ yòng HTML de link duì xiàngshì xià
  <head>
  <title>titleofarticle</title>
  <linkrel=stylesheethref="http://baike.baidu.com/css/font.css"type="text/css">
  </head>
   ér zài XML zhōng yīnggāi xià suǒ shì zài shēng míng zhōng jiā
  <?xml-stylesheettype="text/css"href="http://baike.baidu.com/css/font.css"?>>
   dìng nèi yàng shì kuài duì xiàng (EmbeddingaStyleBlock)
   zài de HTML wén dàng de <HTML> <BODY> biāo zhī jiān chā <STYLE>...</STYLE> kuài duì xiàngdìng fāng shì qǐng cān yuè yàng shì biǎo shì xià
  <html>
  <styletype="text/css">
  <!--
  body{font:10pt"Arial"}
  h1{font:15pt/17pt"Arial";font-weight:bold;color:maroon}
  h2{font:13pt/15pt"Arial";font-weight:bold;color:blue}
  p{font:10pt/12pt"Arial";color:black}
  -->
  </style>
  <body>
   qǐng zhù zhè jiāng style duì xiàng de type shǔ xìng shè zhì wéi "text/css", shì yǔn zhī chí zhè lèi xíng de liú lǎn lüè yàng shì biǎo dān
   nèi lián dìng (InlineStyles)
   nèi lián dìng shì zài duì xiàng de biāo nèi shǐ yòng duì xiàng de style shǔ xìng dìng shì yòng de yàng shì biǎo shǔ xìngshì xià
   zhèyīháng bèi zēng jiā liǎo zuǒ yòu de wài dīng
   yàng shì biǎo (CSSSyntax)
  Selector{property:value}
   cān shù shuō míng
  Selector-- xuǎn
  property:value-- yàng shì biǎo dìng shǔ xìng shǔ xìng zhí zhī jiān yòng mào hào (:) kāidìng zhī jiān yòng fēn hào (;) kāi
   chéng de zhí (The'Inherit'Value)
   měi shǔ xìng dōuyòu zhǐ dìng de zhí: Inherit。 de shìjiāng duì xiàng de zhí děng tóng wéi suàn zhí dàozhè zhí tōng cháng jǐn jǐn shì bèi yòng dexiǎn shì de shēng míng yòng lái qiáng diào
   xuǎn shuō míng
  # biǎo shì xuǎn id
  . biǎo shì xuǎn class
   yòu
   zhè shí jiù yòng #test{ shǔ xìng } lái gěi id wéi test de div lái zhì dìng yàng shì
   ér
   yīnggāi yòng .test{ shǔ xìng } lái gěi zhǐ dìng yàng shì
gēn fēn biàn shuài tóngdiào yòng tóng de css wén jiàn
  dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellSpacing=0 cellPadding=6 width="95%" align=center border=0> <SCRIPT LANGUAGE="javascript">
  <!--
  if (window.navigator.userAgent.indexOf("MSIE")>=1)
  {
  var IE1024="";
  var IE800="";
  var IE1152="";
  var IEother="";
  ScreenWidth(IE1024,IE800,IE1152,IEother)
  }else{
  if (window.navigator.userAgent.indexOf("Firefox")>=1)
  {
  file:// guǒ liú lǎn wéi Firefox
  varFirefox1024="";
  varFirefox800="";
  varFirefox1152="";
  varFirefoxother="";
  ScreenWidth(Firefox1024,Firefox800,Firefox1152,Firefoxother)
  }else{
  file:// guǒ liú lǎn wéi
  varOther1024="";
  varOther800="";
  varOther1152="";
  varOtherother="";
  ScreenWidth(Other1024,Other800,Other1152,Otherother)
  }
  }
  functionScreenWidth(CSS1,CSS2,CSS3,CSS4){
  if((screen.width==1024)&&(screen.height==768)){
  setActiveStyleSheet(CSS1);
  }else{
  if((screen.width==800)&&(screen.height==600)){
  setActiveStyleSheet(CSS2);
  }else{
  if((screen.width==1152)&&(screen.height==864)){
  setActiveStyleSheet(CSS3);
  }else{
  setActiveStyleSheet(CSS4);
  }}}
  }
  functionsetActiveStyleSheet(title){
  document.getElementsByTagName("link")[0].href="style/"+title;
  }
  file://-->
  </SCRIPT>
   jiě shì
  varIE1024="";
  varIE800="";
  varIE1152="";
  varIEother="";
   yǐn hào miàn fēn bié tián xiěyòng shǐ yòng IE de shí hòu bìng qiě fēn biàn shuài wéi 1024*768,800*600,1152*864 yào shǐ yòng de css wén jiàn míng .
  varFirefox1024="";
  varFirefox800="";
  varFirefox1152="";
  varFirefoxother="";
   yǐn hào miàn fēn bié tián xiěyòng shǐ yòng FF de shí hòu bìng qiě fēn biàn shuài wéi 1024*768,800*600,1152*864 yào shǐ yòng de css wén jiàn míng .
  varOther1024="";
  varOther800="";
  varOther1152="";
  varOtherother="";
   yǐn hào miàn fēn bié tián xiěyòng shǐ yòng liú lǎn de shí hòu bìng qiě fēn biàn shuài wéi 1024*768,800*600,1152*864 yào shǐ yòng de css wén jiàn míng .
   pàn duàn fēn biàn shuàizhǐ pàn duàn liú lǎn
   yìng E.Qiang biān xià dài shí xiàn gēn liú lǎn lèi xíng dòng diào yòng tóng CSS。
   dài
  <SCRIPTLANGUAGE="javascript">
  <!--
  if(window.navigator.userAgent.indexOf("MSIE")>=1)
  {
  file:// guǒ liú lǎn wéi IE
  setActiveStyleSheet("default.css");
  }else{
  if(window.navigator.userAgent.indexOf("Firefox")>=1)
  {
  file:// guǒ liú lǎn wéi Firefox
  setActiveStyleSheet("default2.css");
  }else{
  file:// guǒ liú lǎn wéi
  setActiveStyleSheet("newsky.css");
  }
  }
  functionsetActiveStyleSheet(title){
  document.getElementsByTagName("link")[0].href="style/"+title;
  }
  file://-->
  </SCRIPT>
   jiě shì
   guǒ liú lǎn wéi IE, diào yòng default.css
   guǒ liú lǎn wéi Firefox, diào yòng default2.css
   guǒ liú lǎn wéi diào yòng newsky.css
   yòng fàng zài <head></head> zhōng
   zhōng guó zhuān css biāo zhǔn huà tuī guǎng wǎng zhàn【 Div zhī jiā】 www.divhome.com
  =======================================================================
  css céng dié yàng shì biǎo
   yǐn céng dié yàng shì biǎo de fāng bāo kuò
  1, wài lián shì yàng shì biǎo
  2, nèi qiàn yàng shì biǎo
  3, yuán nèi dìng
  4, dǎo yàng shì biǎo
   wài lián shì yàng shì biǎo
   : <head>
  <linkrel="stylesheet"href="/css/default.css">
  </head>
  <body>
  ....
  </body>
  </html>
   shǔ xìng: rel yòng lái shuō míng <link> yuán zài zhè yào wán chéng de rèn shì lián jiē de css wén jiànér href shǔ xìng gěi chū liǎo suǒ yào lián jiē css wén jiàn de url zhǐ
   nèi qiàn shì yàng shì biǎo
   : <html>
  <head>
  <styletype="text/css">
  <!--
  td{font:9pt;color:red}
  .font105{font:10.5pt;color:blue}
  -->
  </style>
  </head>
  <body>....</body>
  </html>
   yuán nèi dìng
   shì
   dǎo shì yàng shì biǎo
   html>
  <head>
  <styletype="text/css">
  <!--
  @importurl(css/home.css);
  -->
  </style>
  <body>
  ....
  </body>
  </html>
  css yàng shì biǎo - cān shù shuō míng
  Selector-- xuǎn
  property:value-- yàng shì biǎo dìng shǔ xìng shǔ xìng zhí zhī jiān yòng mào hào (:) kāidìng zhī jiān yòng fēn hào (;) kāi
   chéng de zhí (The'Inherit'Value)
   měi shǔ xìng dōuyòu zhǐ dìng de zhí: Inherit。 de shìjiāng duì xiàng de zhí děng tóng wéi suàn zhí dàozhè zhí tōng cháng jǐn jǐn shì bèi yòng dexiǎn shì de shēng míng yòng lái qiáng diào
  css yàng shì biǎo de mìng míng
  div+css yàng shì biǎo de id class de bié : jiù lái gài kuò ,class dìng duō zhí bìng qiě yìng yòng dào duō biāo qiān shàngdàn id zhǐ néng shì suǒ jiù kāi shǐ chá xiē xiāng guān de div+css yàng shì biǎo id class de cháng yòng mìng míng guī qǐng jiā cān kǎo xià
   shǒu xiān jiǎng xià div+css yàng shì biǎo de id de cháng yòng mìng míng guī
   tóu: header dēng tiáo: loginBar biāo zhì: logo lán: sideBar guǎng gào: banner dǎo háng: nav dǎo háng: subNav cài dān: menu cài dān: subMenu sōu suǒ: search gǔn dòng: scroll miàn zhù : main nèi róng: content biāo qiān : tab wén zhāng liè biǎo: list shì xìn : msg xiǎo qiǎo: tips lán biāo : title jiā : joinus zhǐ nán: guild : service diǎn: hot xīn wén: news xià zài: download zhù : regsiter zhuàng tài: status 'àn niǔ: btn tóu piào: vote zuò huǒ bàn: partner yǒu qíng liàn jiē: friendLink jiǎo: footer bǎn quán: copyRight
   shí shàng shàng miàn de div+css yàng shì biǎo de id mìng míng huì jīng cháng yòng xiǎo xiě _ lái fēn zhù dǎo háng jiù shì MainNav, guǒ hái yòu yào zài fēn jiù shì MainNav_1,MainNav_2 děng děng shǐ yòng " lèi xíng + biàn liàng míng chēng " de guī lái mìng míng xiě hóng de class, .f_red{}(f shì font de suō xiě )。 zǒng zhī yuán shì xiǎo xiě、 _、 suō xiě zēng qiáng dài de xìng
   zài jiǎng xià div+css yàng shì biǎo de class de cháng yòng mìng míng guī
   wài tào: wrap zhù dǎo háng: mainNav dǎo háng: subnav   jiǎo: footer zhěng miàn: content   méi: header   jiǎo: footer shāng  biāo: label biāo  : title zhù dǎo háng: mainNav( globalNav) biān dǎo háng: sidebar zuǒ dǎo háng: leftsideBar yòu dǎo háng: rightsideBar   zhì: logo biāo  : banner cài dān nèi róng: menu1Content cài dān róng liàng: menuContainer cài dān: submenu biān dǎo háng biāo: sidebarIcon zhù shì: note miàn bāo xiè: breadCrumb( miàn suǒ chù wèi zhì dǎo háng shìróng : container nèi róng: content sōu suǒ: search dēng : login gōng néng : shop( gòu chēshōu yín tái ) dāng qián de: current
   dāng rán xiàng div+css yàng shì biǎo de id class de mìng míng yuǎn yuǎn zhǐ zhè xiē , néng hái huì yòu gèng duō de mìng míng , yòng xiē tōng de dǒng . róng jiě de xiē lái mìng míng , guǒ nín yòu gèng hǎo de div+css yàng shì biǎo de id class de mìng míng guī de huà , qǐng liú yánduō duō zhǐ jiào .