隨筆-16  評論-0  文章-0  trackbacks-0

          讓我們開始閱讀這本書

          我所用的工具

          UltraEdit

          IE 瀏覽器

          第1章? 打下基礎(chǔ)

          在這章我們將學(xué)習(xí)到:

          1.一個好的結(jié)構(gòu)的重要性和有意義的文檔
          2.編寫最優(yōu)方法
          3.共有的編寫錯誤
          4.文檔類型,DOCTYPE switching和瀏覽器樣式
          5.建立自己的樣式
          6.層疊,特征和繼承

          (X)html包括很多元素。例如

          h1,h2,..
          ul,ol,dl
          strong,em
          blockquote,cite
          abbr,acronym,code
          fieldset,legend,label
          caption,thead,tbody,tfoot?

          IDs 和類名(class names)

          <ul id="mainNav">
          <li><a href="#">Home</a></li>
          <li><a href="#">About Us</a></li>
          <li><a href="#">Contact</a></li>
          </ul>


          Divs 和 spans

          <div id="mainNav">
          <ul>
          <li>Home</li>
          <li>About Us</li>
          <li>Contact</li>
          </ul>
          </div>

          簡化

          <ul id="mainNav">
          <li>Home</li>
          <li>About Us</li>
          <li>Contact</li>
          </ul>

          <h2>Where’s Durstan?</h2>
          <p>Published on <span class="date">March 22nd, 2005</span>
          by <span class="author">Andy Budd</span></p>


          DOCTYPE switching
          (X)HTML 文檔遵循的文檔類型定義(DTD)。

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
          "

          建立自己的樣式

          Common selectors

          Type selectors

          p {color: black;}
          a {text-decoration: underline;}
          h1 {font-weight: bold;}

          descendant selectors

          li a {text-decoration: none;}

          ID and class selectors

          #intro {font-weight: bold;}
          .datePosted {color: green;}
          <p id="intro">Some Text</p>
          <p class="datePosted">24/3/2006</p>

          #mainContent h1 {font-size: 1.8em;}
          #secondaryContent h1 {font-size: 1.2em;}
          <div id="mainContent">
          <h1>Welcome to my site</h1>
          ...
          </div>
          <div id="secondaryContent">
          <h1>Latest news</h1>
          ...
          </div>

          Pseudo-classes

          /* makes all unvisited links blue */
          a:link {color:blue;}

          /* makes all visited links green */
          a:visited {color:green;}

          /* makes links red when hovered or activated */
          a:hover, a:active {color:red;}

          /* makes table rows red when hovered over */
          tr:hover {background-color: red;}

          /* makes input elements yellow when focus is applied */
          input:focus {background-color:yellow;}
          ???????
          IE 6 對 :focus不支持

          The universal selector

          * {
          padding: 0;
          margin: 0;
          }

          Advanced selectors

          Child and adjacent sibling selectors

          #nav > li {font-weight: bold;}
          <ul id="nav">
          <li>Home</li>
          <li>Services
          <ul>
          <li>Design</li>
          <li>Development</li>
          <li>Consultancy</li>
          </ul>
          </li>
          <li>Contact Us </li>
          </ul>

          覆蓋
          #nav li {font-weight: bold;}
          #nav li * {font-weight: normal;}

          共用
          h1 + p {font-weight: bold;}
          <h1>Main Heading</h1>
          <p>First Paragraph</p>
          <p>Second Paragraph</p>

          Attribute selectors

          <abbr title="Cascading Style Sheets">CSS</abbr>

          abbr[title] {border-bottom: 1px dotted #999;}
          abbr[title]:hover {cursor: help;}

          a[rel="nofollow"] {
          background-image: url(nofollow.gif);
          padding-right: 20px;
          }

          .intro {border-style: solid;}
          [class="intro"] {border-style: dotted;}

          a[rel~="friend"] {background-image: url(friend.gif);}
          <a href="
          John Hicks
          </a>

          ?

          主站蜘蛛池模板: 瓮安县| 扎赉特旗| 闽清县| 定陶县| 汉沽区| 金溪县| 全椒县| 周口市| 鸡东县| 虹口区| 辛集市| 日土县| 临澧县| 黄浦区| 西青区| 湘乡市| 彩票| 梅州市| 柳林县| 贡山| 横峰县| 玛沁县| 海城市| 石泉县| 肃宁县| 东台市| 滕州市| 临武县| 白河县| 灵武市| 宝坻区| 遵化市| 正镶白旗| 富顺县| 德格县| 蒙阴县| 广水市| 武城县| 法库县| 沾益县| 西华县|