Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 国产成人精品日本亚洲直播一,久久精品a一国产成人免费网站,91精品国产高清久久久久久91

          整合營銷服務商

          電腦端+手機端+微信端=數據同步管理

          免費咨詢熱線:

          HTML網頁編程之表格樣式

          頁編程之表格樣式。

          同學們好,我是一名免費的少兒編程老師。今天我要分享的內容是以列為單位設置表格樣式。在插入表格課程中,我已經講解了HTML中沒有單獨的列標簽,列是由對應的單元格組成的行形成的。雖然如此,但列這個概念仍然是存在的。

          讓我們來看一下今天的示例效果。這個網頁上有一個3行3列的表格,其中3列分別是姓名、科目和分數,而3行分別是表頭行、字體加粗的內容和兩行。第一列和第二列的背景顏色是綠色,第三列的背景顏色是灰色。在一列中,每一個單元格的樣式都是統一的。

          接下來,讓我們看看實現的代碼。以列為單位設置表格樣式,實際上是通過這兩個標簽來實現的,分別是colgroup和col。colgroup翻譯過來就是“列”的意思,而colgroup則是“列主”的意思。

          首先,讓我們來看看colgroup標簽。這個標簽是一個無屬性的圍堵標簽,它的作用只有一個,即聲明這個標簽內包含的是本表格列的樣式。通過這個標簽,我們可以向整個列應用樣式,而不需要為每一個單元格或每一行設置樣式。

          這個標簽必須在table標簽內,如果有caption標簽,則必須在thead標簽之前使用。如果不明白各標簽的先后順序,可以看看上節課的內容。colgroup標簽僅僅是聲明,具體的樣式是要使用col標簽來實現的。col標簽的數量應該與TDTH的標簽數量一致,一一對應地設置。第1行的col標簽對應第1列的樣式,第2行的col標簽對應第2列的樣式,以此類推。

          有些同學會問,老師,你這里的表格有三列,但是你只寫了兩個col標簽,這時候就要講到col標簽在HTML5中的兩個常用屬性,一個是col屬性,說明了這一行的col標簽的樣式可以跨幾列。

          例如,在這里將第一行的col標簽的Span屬性設置為2,這就意味著這個樣式在當前位置跨了兩列。換句話說,讓第一列和第二列使用了同一個樣式。

          第二個屬性是它的style標簽。這個style標簽的內容是CSS的一段代碼,通過這個屬性我們可以為列添加各種效果。嚴格來說,style并不是卡標簽的一個專用屬性,而是HTML的全局屬性之一。所謂的全局屬性就是只要是HTML標簽都自帶這一個屬性。對于各位同學來說,這是一個新概念,你們只需要記住就可以了。通過使用colgroup標簽和col標簽的配合,我們不僅能夠靈活快速地為表格添加樣式,進行美化,還能大幅減少代碼量,提高頁面加載速度。

          以上就是今天的分享,希望各位同學能夠牢記在心,并在下一次練習中做到不看視頻也能夠寫出代碼。如果需要獲取相關案例和文檔,可以向我提問。我們下期再見。如果你對網頁編程、服務端編程、數據庫、算法等感興趣,歡迎點贊、關注!

          接到很web前端項目中,常常看到表格table,做表格的樣式,在本文下面,列舉了四種表格css樣式,代碼也在下面:

          1.單像素邊框CSS表格
          這是一個很常用的表格樣式。


          <!-- CSS goes in the document HEAD or added to your external stylesheet -->
          <style type="text/css">
          table.gridtable {
          font-family: verdana,arial,sans-serif;
          font-size:11px;
          color:#333333;
          border-width: 1px;
          border-color: #666666;
          border-collapse: collapse;
          }
          table.gridtable th {
          border-width: 1px;
          padding: 8px;
          border-style: solid;
          border-color: #666666;
          background-color: #dedede;
          }
          table.gridtable td {
          border-width: 1px;
          padding: 8px;
          border-style: solid;
          border-color: #666666;
          background-color: #ffffff;
          }
          </style>
          <!-- Table goes in the document BODY -->
          <table class="gridtable">
          <tr>
          <th>Info Header 1</th><th>Info Header 2</th><th>Info Header 3</th>
          </tr>
          <tr>
          <td>Text 1A</td><td>Text 1B</td><td>Text 1C</td>
          </tr>
          <tr>
          <td>Text 2A</td><td>Text 2B</td><td>Text 2C</td>
          </tr>
          </table>

          2. 帶背景圖的CSS樣式表格

          和上面差不多,不過每個格子里多了背景圖。







          1. 下載上面兩張圖,命名為cell-blue.jpg和cell-grey.jpg

          2. 拷貝下面的代碼到你想要的地方,記得修改圖片url

          <!-- CSS goes in the document HEAD or added to your external stylesheet -->
          <style type="text/css">
          table.imagetable {
          font-family: verdana,arial,sans-serif;
          font-size:11px;
          color:#333333;
          border-width: 1px;
          border-color: #999999;
          border-collapse: collapse;
          }
          table.imagetable th {
          background:#b5cfd2 url('cell-blue.jpg');
          border-width: 1px;
          padding: 8px;
          border-style: solid;
          border-color: #999999;
          }
          table.imagetable td {
          background:#dcddc0 url('cell-grey.jpg');
          border-width: 1px;
          padding: 8px;
          border-style: solid;
          border-color: #999999;
          }
          </style>
          <!-- Table goes in the document BODY -->
          <table class="imagetable">
          <tr>
          <th>Info Header 1</th><th>Info Header 2</th><th>Info Header 3</th>
          </tr>
          <tr>
          <td>Text 1A</td><td>Text 1B</td><td>Text 1C</td>
          </tr>
          <tr>
          <td>Text 2A</td><td>Text 2B</td><td>Text 2C</td>
          </tr>
          </table>

          3. 自動換整行顏色的CSS樣式表格(需要用到JS)

          這個CSS樣式表格自動切換每一行的顏色,在我們需要頻繁更新一個大表格的時候很有用。


          <!-- Javascript goes in the document HEAD -->
          <script type="text/javascript">
          function altRows(id){
          if(document.getElementsByTagName){
          var table = document.getElementById(id);
          var rows = table.getElementsByTagName("tr");
          for(i = 0; i < rows.length; i++){
          if(i % 2 == 0){
          rows[i].className = "evenrowcolor";
          }else{
          rows[i].className = "oddrowcolor";
          }
          }
          }
          }
          window.onload=function(){
          altRows('alternatecolor');
          }
          </script>
          <!-- CSS goes in the document HEAD or added to your external stylesheet -->
          <style type="text/css">
          table.altrowstable {
          font-family: verdana,arial,sans-serif;
          font-size:11px;
          color:#333333;
          border-width: 1px;
          border-color: #a9c6c9;
          border-collapse: collapse;
          }
          table.altrowstable th {
          border-width: 1px;
          padding: 8px;
          border-style: solid;
          border-color: #a9c6c9;
          }
          table.altrowstable td {
          border-width: 1px;
          padding: 8px;
          border-style: solid;
          border-color: #a9c6c9;
          }
          .oddrowcolor{
          background-color:#d4e3e5;
          }
          .evenrowcolor{
          background-color:#c3dde0;
          }
          </style>
          <!-- Table goes in the document BODY -->
          <table class="altrowstable" id="alternatecolor">
          <tr>
          <th>Info Header 1</th><th>Info Header 2</th><th>Info Header 3</th>
          </tr>
          <tr>
          <td>Text 1A</td><td>Text 1B</td><td>Text 1C</td>
          </tr>
          <tr>
          <td>Text 2A</td><td>Text 2B</td><td>Text 2C</td>
          </tr>
          </tr>
          <tr>
          <td>Text 3A</td><td>Text 3B</td><td>Text 3C</td>
          </tr>
          <tr>
          <td>Text 4A</td><td>Text 4B</td><td>Text 4C</td>
          </tr>
          <tr>
          <td>Text 5A</td><td>Text 5B</td><td>Text 5C</td>
          </tr>
          </table>
          <!-- The table code can be found here: http://www.textfixer/resources/css-tables.php#css-table03 -->

          4. 鼠標懸停高亮的CSS樣式表格 (需要JS)

          純CSS顯示表格高亮在IE中顯示有問題,所以這邊使用了JS來做高亮(由于csdn博客限制了js的使用,我會在近期將博客遷移放到自己的web主機上)。

          <!-- CSS goes in the document HEAD or added to your external stylesheet -->
          <style type="text/css">
          table.hovertable {
          font-family: verdana,arial,sans-serif;
          font-size:11px;
          color:#333333;
          border-width: 1px;
          border-color: #999999;
          border-collapse: collapse;
          }
          table.hovertable th {
          background-color:#c3dde0;
          border-width: 1px;
          padding: 8px;
          border-style: solid;
          border-color: #a9c6c9;
          }
          table.hovertable tr {
          background-color:#d4e3e5;
          }
          table.hovertable td {
          border-width: 1px;
          padding: 8px;
          border-style: solid;
          border-color: #a9c6c9;
          }
          </style>
          <!-- Table goes in the document BODY -->
          <table class="hovertable">
          <tr>
          <th>Info Header 1</th><th>Info Header 2</th><th>Info Header 3</th>
          </tr>
          <tr onmouseover="this.style.backgroundColor='#ffff66';"
          onmouseout="this.style.backgroundColor='#d4e3e5';">
          <td>Item 1A</td><td>Item 1B</td><td>Item 1C</td>
          </tr>
          <tr onmouseover="this.style.backgroundColor='#ffff66';"
          onmouseout="this.style.backgroundColor='#d4e3e5';">
          <td>Item 2A</td><td>Item 2B</td><td>Item 2C</td>
          </tr>
          <tr onmouseover="this.style.backgroundColor='#ffff66';"

          onmouseout="this.style.backgroundColor='#d4e3e5';">
          <td>Item 3A</td><td>Item 3B</td><td>Item 3C</td>
          </tr>
          <tr onmouseover="this.style.backgroundColor='#ffff66';"
          onmouseout="this.style.backgroundColor='#d4e3e5';">
          <td>Item 4A</td><td>Item 4B</td><td>Item 4C</td>
          </tr>
          <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
          <td>Item 5A</td><td>Item 5B</td><td>Item 5C</td>
          </tr>
          </table>

          文/丁向明

          做一個有博客的web前端自媒體人,專注web前端開發,關注用戶體驗,加我qq/微信交流:6135833

          http://dingxiangming.com

          家好,我是IT共享者,人稱皮皮。這篇文章我們來講講CSS的文本樣式。

          一、文本顏色Color

          顏色屬性被用來設置文字的顏色。

          顏色是通過CSS最經常的指定:

          • 十六進制值 - 如"#FF0000"。
          • 一個RGB值 - "RGB(255,0,0)"。
          • 顏色的名稱 - 如"紅"。

          一個網頁的文本顏色是指在主體內的選擇:

          <html>
              <head>
                  <meta charset="utf-8">
                  <meta name="viewport" content="width=640, user-scalable=no">
                  <title>項目</title>
                  <style>
                      body {
                          color: blue;
                      }
          
          
                      h1 {
                          color: #00ff00;
                      }
          
          
                      h2 {
                          color: rgb(255, 0, 0);
                      }
          </style>
              </head>
          
          
              <body>
                  <h2>hello world</h2>
                  <h1>welcome to CaoZhou</h1>
              </body>
          
          
          </html>

          注:對于W3C標準的CSS:如果你定義了顏色屬性,你還必須定義背景色屬性。


          二、屬性

          1. text-align 文本的對齊方式

          文本排列屬性是用來設置文本的水平對齊方式。

          文本可居中或對齊到左或右,兩端對齊。

          當text-align設置為"justify",每一行被展開為寬度相等,左,右外邊距是對齊(如雜志和報紙)。

          <!doctype html>
          <html lang="en">
          
          
              <head>
                  <meta charset="UTF-8">
                  <title>Document</title>
                  <style>
                      h1 {
                          text-align: center;
                      }
          
          
                      p.date {
                          text-align: right;
                      }
          
          
                      p.main {
                          text-align: justify;
                      }
          </style>
              </head>
          
          
              <body>
          
          
                  <p class="date">2015 年 3 月 14 號</p>
                  <p class="main"> 從前有個書生,和未婚妻約好在某年某月某日結婚。到那一天,未婚妻卻嫁給了別人。書生受此打擊, 一病不起。  這時,路過一游方僧人,從懷里摸出一面鏡子叫書生看。書生看到茫茫大海,一名遇害的女子一絲不掛地躺在海灘上。路過一人, 看一眼,搖搖頭,走了。又路過一人,將衣服脫下,給女尸蓋上,走了。再路過一人,過去,挖個坑,小心翼翼把尸體掩埋了。  僧人解釋道, 那具海灘上的女尸,就是你未婚妻的前世。你是第二個路過的人,曾給過他一件衣服。她今生和你相戀,只為還你一個情。但是她最終要報答一生一世的人,是最后那個把她掩埋的人,那人就是他現在的丈夫。書生大悟,病愈。
          
          
                  </p>
                  <p><b>注意:</b> 重置瀏覽器窗口大小查看 "justify" 是如何工作的。</p>
              </body>
          
          
          </html>

          2. text-decoration文本修飾

          text-decoration 屬性用來設置或刪除文本的裝飾。

          從設計的角度看 text-decoration屬性主要是用來刪除鏈接的下劃線:

          <!doctype html>
          <html lang="en">
          
          
              <head>
                  <meta charset="UTF-8">
                  <title>Document</title>
                  <style>
                      .none {}
          
          
                      .del {
                          text-decoration: none;
                      }
          </style>
              </head>
          
          
              <body>
                  <p>原來的樣子</p>
                  <a href="#" class="none">wwwwwwwwwwwwwwwwww</a>
                  <p>去掉下劃線</p>
                  <a href="#" class="del">wwwwwwwwwwwwwwwwwwwww</a>
              </body>
          
          
          </html>

          也可以這樣裝飾文字:

          <html>
              <head>
                  <meta charset="utf-8">
                  <meta name="viewport" content="width=640, user-scalable=no">
                  <title>項目</title>
                  <style>
                      h1 {
                          text-decoration: overline;
                      }
          
          
                      h2 {
                          text-decoration: line-through;
                      }
          
          
                      h3 {
                          text-decoration: underline;
                      }
          </style>
              </head>
          
          
              <body>
                  <h1>This is heading 1</h1>
                  <h2>This is heading 2</h2>
                  <h3>This is heading 3</h3>
              </body>
          
          
          </html>

          注:不建議強調指出不是鏈接的文本,因為這常常混淆用戶。


          3. text-transform文本轉換

          text-transform文本轉換屬性是用來指定在一個文本中的大寫和小寫字母。

          • uppercase:轉換為全部大寫。
          • lowercase:轉換為全部小寫。
          • capitalize :每個單詞的首字母大寫。
          <!DOCTYPE html>
          <html>
          
          
              <head>
                  <meta charset="utf-8">
                  <meta name="viewport" content="width=640, user-scalable=no">
                  <title>項目</title>
                  <style>
                      p.uppercase {
                          text-transform: uppercase;
                      }
          
          
                      p.lowercase {
                          text-transform: lowercase;
                      }
          
          
                      p.capitalize {
                          text-transform: capitalize;
                      }
          </style>
              </head>
          
          
              <body>
                  <p class="uppercase">This is some text.</p>
                  <p class="lowercase">This is some text.</p>
                  <p class="capitalize">This is some text.</p>
              </body>
          
          
          </html>

          4. text-indent文本縮進

          text-indent文本縮進屬性是用來指定文本的第一行的縮進。

          p {text-indent:50px;}

          5. letter-spacing 設置字符間距

          增加或減少字符之間的空間。

          <style>
               h1 {
                 letter-spacing:2px;
          }
                h2 {
                  letter-spacing:-3px;
          }
          </style>

          6. line-height設置行高

          指定在一個段落中行之間的空間。

          <html>
              <head>
                  <meta charset="utf-8">
                  <meta name="viewport" content="width=640, user-scalable=no">
                  <title>項目</title>
                  <style>
                      p.small {
                          line-height: 70%;
                      }
          
          
                      p.big {
                          line-height: 200%;
                      }
          </style>
              </head>
          
          
              <body>
                  <p>
                      This is a paragraph with a standard line-height.<br> This is a paragraph with a standard line-height.<br> The default line height in most browsers is about 110% to 120%.<br>
                  </p>
          
          
                  <p class="small">
                      This is a paragraph with a smaller line-height.<br> This is a paragraph with a smaller line-height.<br> This is a paragraph with a smaller line-height.<br> This is a paragraph with a smaller line-height.<br>
                  </p>
          
          
                  <p class="big">
                      This is a paragraph with a bigger line-height.<br> This is a paragraph with a bigger line-height.<br> This is a paragraph with a bigger line-height.<br> This is a paragraph with a bigger line-height.<br>
                  </p>
          
          
              </body>
          
          
          </html>

          7. word-spacing 設置字間距

          增加一個段落中的單詞之間的空白空間。

          <html>
              <head>
                  <meta charset="utf-8">
                  <meta name="viewport" content="width=640, user-scalable=no">
                  <title>項目</title>
                  <style type="text/css">
                      p {
                          word-spacing: 30px;
                      }
          </style>
              </head>
          
          
              <body>
          
          
                  <p>
                      This is some text. This is some text.
                  </p>
          
          
              </body>
          
          
          </html>

          8. vertical-align 設置元垂直居中

          設置文本的垂直對齊圖像。

          <html>
              <head>
                  <meta charset="utf-8">
                  <meta name="viewport" content="width=640, user-scalable=no">
                  <title>項目</title>
                  <style>
                      img{
                          width: 200px;
                          height: 100px;
                      }
                      img.top {
                          vertical-align: text-top;
          
          
                      }
          
          
                      img.bottom {
                          vertical-align: text-bottom;
          
          
                      }
          </style>
              </head>
          
          
              <body>
                  <p>An <img src="img/logo.png"  /> image with a default alignment.</p>
                  <p>An <img class="top" src="img/logo.png" /> image with a text-top alignment.</p>
                  <p>An <img class="bottom" src="img/logo.png" /> image with a text-bottom alignment.</p>
              </body>
          
          
          </html>

          9. text-shadow 設置文本陰影

          設置文本陰影。

          <html>
              <head>
                  <meta charset="utf-8">
                  <meta name="viewport" content="width=640, user-scalable=no">
                  <title>項目</title>
                  <style>
                   h1{
                      text-shadow: 2px 2px #FF0000;
               }
          </style>
              </head>
          
          
              <body>
              <h1>Text-shadow effect</h1>
              </body>
          
          
          </html>

          三、總結

          本文主要介紹了CSS文本樣式實際應用中應該如何去操作,通過講解文本中對應的屬性去改變文本的表現形式。使用豐富的效果圖的展示,能夠更直觀的看到運行的效果,能夠更好的理解。使用Html語言,代碼結構更佳的清晰,能夠幫助你更好的學習。


          主站蜘蛛池模板: 亚洲一区二区观看播放| 国产一区二区精品久久岳√| 国产波霸爆乳一区二区| 日韩精品一区二区三区中文| 午夜DV内射一区区| 精品国产伦一区二区三区在线观看| 亚洲a∨无码一区二区| 日韩精品无码久久一区二区三| 精品人妻系列无码一区二区三区| 日韩人妻无码一区二区三区综合部| 竹菊影视欧美日韩一区二区三区四区五区 | 日韩在线一区二区三区免费视频| 精品无码一区二区三区爱欲九九 | 亚洲高清美女一区二区三区| 国产免费无码一区二区| 免费观看日本污污ww网站一区| 亚洲Av无码一区二区二三区| 久久精品一区二区三区四区| 东京热人妻无码一区二区av| 中文字幕一区日韩在线视频| 精品国产一区二区三区AV性色| 国产一区二区三区在线观看影院 | 国模一区二区三区| 精品国产一区二区三区www| 国产精品久久久久久一区二区三区 | 亚洲宅男精品一区在线观看| 精品一区精品二区制服| 人妻天天爽夜夜爽一区二区| 日本午夜精品一区二区三区电影| 亚洲一区二区影院| 一本一道波多野结衣一区| 国产Av一区二区精品久久| 国模无码视频一区二区三区| 日本韩国黄色一区二区三区 | 亚洲av综合av一区| 无码人妻精品一区二区三区66| 亚洲午夜在线一区| 精品国产一区二区三区av片| 一区二区三区免费视频网站| 国产成人AV一区二区三区无码| 精品无码一区二区三区爱欲|