gembin

          OSGi, Eclipse Equinox, ECF, Virgo, Gemini, Apache Felix, Karaf, Aires, Camel, Eclipse RCP

          HBase, Hadoop, ZooKeeper, Cassandra

          Flex4, AS3, Swiz framework, GraniteDS, BlazeDS etc.

          There is nothing that software can't fix. Unfortunately, there is also nothing that software can't completely fuck up. That gap is called talent.

          About Me

           

          CSS頁碼效果


          不知道網上有沒有做成這樣的,純粹是不小心做出來的。
          最終效果說明:
          頁面結構是這樣的

          <li><a href="#">1</a></li>
          最終看到的彩色下劃線是根據li的背景色顯示出來的
          li{background:#f60;}

          而鼠標移上去的色彩變化是根據

          a:hover{background:#f93}
          當然關鍵的地方在于
          li{width:20px;height:20px}

          定義li的高度時由于沒有定義line-height:20px,所以會造成a標簽在顯示時下方會留空幾個像素。正在由于這個錯誤,無意中產生了這個效果

          請運行下段代碼看效果。

          以下為源代碼 你可先修改部分代碼,再測試:
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml" lang="gb2312">
              
          <head>
                  
          <title></title>
                  
          <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

                  
          <style type="text/css">
                      body
          {
                          font-size
          :62.5%;
                      
          }
                      h1
          {
                          font-size
          :1.4em;
                      
          }
                      h2
          {
                          clear
          :both;
                          font-size
          :1.2em;
                      
          }
                      #pageClass
          {
                          clear
          :both;
                          font-size
          :1.2em;
                      
          }
                      #pageClass ul
          {
                          list-style
          :none;
                      
          }
                      #pageClass li
          {
                          float
          :left;
                          width
          :20px;
                          height
          :20px;
                          line-height
          :20px;
                          border
          :1px solid silver;
                          margin
          :0 3px;
                      
          }
                      #pageClass a
          {
                          display
          :block;
                          text-align
          :center;
                      
          }
                      #pageClass a:link,#pageClass a:visited
          {
                          background
          :white;
                          text-decoration
          : none;
                          color
          :gray;
                      
          }
                      #pageClass a:hover,#pageClass a:active
          {
                          text-decoration
          : none;
                          background
          :gray;
                          color
          :white;
                      
          }

                  
          /*第二個效果*/
                      #pageClass2
          {
                          clear
          :both;
                          font-size
          :1.2em;
                      
          }
                      #pageClass2 ul
          {
                          list-style
          :none;
                      
          }
                      #pageClass2 li
          {
                          float
          :left;
                          width
          :20px;
                          height
          :20px;
                          border
          :1px solid silver;
                          margin
          :0 3px;
                      
          }
                      #pageClass2 a
          {
                          display
          :block;
                          text-align
          :center;
                      
          }
                      #pageClass2 a:link,#pageClass2 a:visited
          {
                          background
          :white;
                          text-decoration
          : none;
                          color
          :gray;
                      
          }
                      #pageClass2 a:hover,#pageClass2 a:active
          {
                          text-decoration
          : none;
                          background
          :gray;
                          color
          :white;
                          line-height
          :14px;
                      
          }
                  
          /*第三個效果*/
                      #pageClass3
          {
                          clear
          :both;
                          font-size
          :1.2em;
                      
          }
                      #pageClass3 ul
          {
                          list-style
          :none;
                      
          }
                      #pageClass3 li
          {
                          float
          :left;
                          width
          :20px;
                          height
          :20px;
                          border
          :1px solid silver;
                          background
          :#f60;
                          margin
          :0 3px;
                      
          }
                      #pageClass3 a
          {
                          display
          :block;
                          text-align
          :center;
                          line-height
          :16px;
                      
          }
                      #pageClass3 a:link,#pageClass3 a:visited
          {
                          background
          :white;
                          text-decoration
          : none;
                          color
          :gray;
                      
          }
                      #pageClass3 a:hover,#pageClass3 a:active
          {
                          text-decoration
          : none;
                          background
          :#f93;
                          color
          :white;
                          line-height
          :16px;
                          
          }
                  
          </style>
              
          </head>

              
          <body>
                  
          <h1>頁碼效果</h1>
                  
          <h2>這是我原本想要去做的效果</h2>
                  
          <div id="pageClass">
                      
          <ul>
                          
          <li><href="#3">1</a></li>
                          
          <li><href="#4">2</a></li>
                          
          <li><href="#5">3</a></li>
                          
          <li><href="#6">4</a></li>
                          
          <li><href="#8">5</a></li>
                          
          <li><href="#9">6</a></li>
                          
          <li><href="http://www.iwcn.net/default.asp">7</a></li>
                      
          </ul>
                  
          </div>
                  
          <h2>做完之后成這樣了</h2>
                  
          <div id="pageClass2">
                      
          <ul>
                          
          <li><href="#3">1</a></li>
                          
          <li><href="#4">2</a></li>
                          
          <li><href="#5">3</a></li>
                          
          <li><href="#6">4</a></li>
                          
          <li><href="#8">5</a></li>
                          
          <li><href="#9">6</a></li>
                          
          <li><href="http://www.iwcn.net/default.asp">7</a></li>
                      
          </ul>
                  
          </div>
                  
          <h2>改了改成這樣了</h2>
                  
          <div id="pageClass3">
                      
          <ul>
                          
          <li><href="#3">1</a></li>
                          
          <li><href="#4">2</a></li>
                          
          <li><href="#5">3</a></li>
                          
          <li><href="#6">4</a></li>
                          
          <li><href="#8">5</a></li>
                          
          <li><href="#9">6</a></li>
                          
          <li><href="">7</a></li>
                      
          </ul>
                  
          </div>
              
          </body>
          </HTML>

          posted on 2008-03-26 14:05 gembin 閱讀(935) 評論(0)  編輯  收藏 所屬分類: HTML

          導航

          統計

          常用鏈接

          留言簿(6)

          隨筆分類(440)

          隨筆檔案(378)

          文章檔案(6)

          新聞檔案(1)

          相冊

          收藏夾(9)

          Adobe

          Android

          AS3

          Blog-Links

          Build

          Design Pattern

          Eclipse

          Favorite Links

          Flickr

          Game Dev

          HBase

          Identity Management

          IT resources

          JEE

          Language

          OpenID

          OSGi

          SOA

          Version Control

          最新隨筆

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          free counters
          主站蜘蛛池模板: 铁岭县| 喀喇沁旗| 防城港市| 体育| 明水县| 绍兴县| 武山县| 漯河市| 喀喇| 长治市| 黄冈市| 衡南县| 南溪县| 化州市| 宁阳县| 龙南县| 沛县| 杭锦后旗| 涡阳县| 隆化县| 格尔木市| 纳雍县| 比如县| 永丰县| 买车| 乳山市| 武清区| 永城市| 扎鲁特旗| 西华县| 武定县| 漳州市| 上蔡县| 东乡族自治县| 榆林市| 轮台县| 绍兴县| 大冶市| 蓝山县| 武鸣县| 乃东县|