隨筆-16  評(píng)論-0  文章-0  trackbacks-0

          讓我們開始閱讀這本書

          我所用的工具

          UltraEdit

          IE 瀏覽器

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

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

          1.一個(gè)好的結(jié)構(gòu)的重要性和有意義的文檔
          2.編寫最優(yōu)方法
          3.共有的編寫錯(cuò)誤
          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>

          ?

          主站蜘蛛池模板: 宁波市| 五寨县| 怀来县| 黄石市| 清水河县| 高淳县| 大厂| 汉沽区| 铁岭市| 灵璧县| 宜宾县| 凤翔县| 赫章县| 壤塘县| 河池市| 玉环县| 芮城县| 深水埗区| 平塘县| 荣昌县| 南昌市| 乌什县| 平原县| 娱乐| 峨眉山市| 六安市| 凭祥市| 马鞍山市| 新龙县| 长子县| 鹤峰县| 富宁县| 武乡县| 杭锦后旗| 花垣县| 江口县| 沙坪坝区| 刚察县| 武威市| 绿春县| 新郑市|