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 久久99亚洲精品一区二区,国产精品第页,中文字幕日韩专区精品系列

          整合營銷服務(wù)商

          電腦端+手機端+微信端=數(shù)據(jù)同步管理

          免費咨詢熱線:

          HTML 表格

          TML 表格實例:

          First NameLast NamePoints
          JillSmith50
          EveJackson94
          JohnDoe80
          AdamJohnson67

          在線實例

          表格

          這個例子演示如何在 HTML 文檔中創(chuàng)建表格。

          HTML 表格

          表格由 <table> 標簽來定義。每個表格均有若干行(由 <tr> 標簽定義),每行被分割為若干單元格(由 <td> 標簽定義)。字母 td 指表格數(shù)據(jù)(table data),即數(shù)據(jù)單元格的內(nèi)容。數(shù)據(jù)單元格可以包含文本、圖片、列表、段落、表單、水平線、表格等等。

          表格實例

          <table border="1">

          <tr>

          <td>row 1, cell 1</td>

          <td>row 1, cell 2</td>

          </tr>

          <tr>

          <td>row 2, cell 1</td>

          <td>row 2, cell 2</td>

          </tr>

          </table>

          在瀏覽器顯示如下::

          row 1, cell 1row 1, cell 2
          row 2, cell 1row 2, cell 2

          HTML 表格和邊框?qū)傩?/p>

          如果不定義邊框?qū)傩裕砀駥⒉伙@示邊框。有時這很有用,但是大多數(shù)時候,我們希望顯示邊框。

          使用邊框?qū)傩詠盹@示一個帶有邊框的表格:

          <table border="1">

          <tr>

          <td>Row 1, cell 1</td>

          <td>Row 1, cell 2</td>

          </tr>

          </table>

          HTML 表格表頭

          表格的表頭使用 <th> 標簽進行定義。

          大多數(shù)瀏覽器會把表頭顯示為粗體居中的文本:

          <table border="1">

          <tr>

          <th>Header 1</th>

          <th>Header 2</th>

          </tr>

          <tr>

          <td>row 1, cell 1</td>

          <td>row 1, cell 2</td>

          </tr>

          <tr>

          <td>row 2, cell 1</td>

          <td>row 2, cell 2</td>

          </tr>

          </table>

          在瀏覽器顯示如下:

          Header 1Header 2
          row 1, cell 1row 1, cell 2
          row 2, cell 1row 2, cell 2

          更多實例

          沒有邊框的表格

          本例演示一個沒有邊框的表格。

          表格中的表頭(Heading)

          本例演示如何顯示表格表頭。

          帶有標題的表格

          本例演示一個帶標題 (caption) 的表格

          跨行或跨列的表格單元格

          本例演示如何定義跨行或跨列的表格單元格。

          表格內(nèi)的標簽

          本例演示如何顯示在不同的元素內(nèi)顯示元素。

          單元格邊距(Cell padding)

          本例演示如何使用 Cell padding 來創(chuàng)建單元格內(nèi)容與其邊框之間的空白。

          單元格間距(Cell spacing)

          本例演示如何使用 Cell spacing 增加單元格之間的距離。

          HTML 表格標簽

          標簽描述
          <table>定義表格
          <th>定義表格的表頭
          <tr>定義表格的行
          <td>定義表格單元
          <caption>定義表格標題
          <colgroup>定義表格列的組
          <col>定義用于表格列的屬性
          <thead>定義表格的頁眉
          <tbody>定義表格的主體
          <tfoot>定義表格的頁腳

          如您還有不明白的可以在下面與我留言或是與我探討QQ群308855039,我們一起飛!

          接到很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前端開發(fā),關(guān)注用戶體驗,加我qq/微信交流:6135833

          http://dingxiangming.com

          現(xiàn)代網(wǎng)頁設(shè)計中,表格依然扮演著不可或缺的角色。無論是數(shù)據(jù)展示、報表制作還是復(fù)雜布局,合理運用HTML中的<table>標簽可以極大地提升網(wǎng)頁的信息結(jié)構(gòu)和用戶體驗。本文將詳細解析HTML表格的高級技巧和創(chuàng)新應(yīng)用,幫助開發(fā)者和設(shè)計師精確掌握使用HTML表格的最佳實踐。

          1. HTML表格基礎(chǔ)

          1.1 表格結(jié)構(gòu)簡介

          HTML表格由<table>標簽創(chuàng)建,基本結(jié)構(gòu)包括<thead>、<tbody>、<tfoot>和<tr>(表格行),以及<th>(表頭單元格)和<td>(表格單元格)。

          1.2 創(chuàng)建一個簡單的表格

          <table>
              <thead>
                  <tr>
                      <th>編號</th>
                      <th>姓名</th>
                      <th>年齡</th>
                  </tr>
              </thead>
              <tbody>
                  <tr>
                      <td>1</td>
                      <td>張三</td>
                      <td>25</td>
                  </tr>
                  <tr>
                      <td>2</td>
                      <td>李四</td>
                      <td>30</td>
                  </tr>
              </tbody>
          </table>
          

          這個例子展示了一個包含標題和兩行數(shù)據(jù)的基本表格。

          2. 樣式化表格

          2.1 使用CSS增強表格視覺

          為表格添加CSS樣式可以提升其視覺效果。例如,可以通過以下CSS代碼增加邊框、調(diào)整文字對齊方式,以及改善表格的顏色和間隔。

          table {
              width: 100%;
              border-collapse: collapse;
          }
          th, td {
              border: 1px solid #ddd;
              padding: 8px;
              text-align: left;
          }
          thead {
              background-color: #f2f2f2;
          }
          

          2.2 響應(yīng)式表格

          在移動設(shè)備上查看時,表格應(yīng)能自動調(diào)整以適應(yīng)不同的屏幕尺寸。可以使用CSS的媒體查詢來實現(xiàn)響應(yīng)式表格,或者利用JavaScript進行更復(fù)雜的操作。

          3. 高級技巧和應(yīng)用

          3.1 合并單元格

          使用rowspan和colspan屬性可以合并行或列,創(chuàng)建跨多個行或列的單元格,這對于匯總信息特別有用。

          <tr>
              <td rowspan="2">合并行</td>
              <td>數(shù)據(jù)1</td>
              <td>數(shù)據(jù)2</td>
          </tr>
          <tr>
              <td>數(shù)據(jù)3</td>
              <td>數(shù)據(jù)4</td>
          </tr>
          

          3.2 交互式表格

          通過JavaScript和AJAX,可以實現(xiàn)表格的動態(tài)數(shù)據(jù)加載和更新,這對于需要實時數(shù)據(jù)顯示的應(yīng)用尤為重要。

          4. 結(jié)語

          掌握HTML表格的使用和優(yōu)化不僅能提升網(wǎng)頁的功能性和美觀,還能改善用戶的瀏覽體驗。隨著技術(shù)的不斷進步,我們預(yù)見表格在網(wǎng)頁設(shè)計中的應(yīng)用將更加靈活和強大。

          結(jié)尾部分:
          希望本文能為你在使用HTML表格時提供新的視角和方法。記得實踐是檢驗真理的唯一標準,不斷嘗試和優(yōu)化,是每個網(wǎng)頁設(shè)計師和開發(fā)者成長的必經(jīng)之路。


          主站蜘蛛池模板: 色一情一乱一伦一区二区三区日本| jazzjazz国产精品一区二区| 精品成人av一区二区三区| 久久久久无码国产精品一区| 大帝AV在线一区二区三区| 无码精品视频一区二区三区| 久久精品无码一区二区app| 色天使亚洲综合一区二区| 亚洲制服丝袜一区二区三区| 一区二区三区观看免费中文视频在线播放 | 亚洲AV无码一区二区三区久久精品 | 欧美成人aaa片一区国产精品| 精品无码一区二区三区亚洲桃色| 国产在线精品一区二区中文| 国产凹凸在线一区二区| 在线观看国产区亚洲一区成人 | 日韩精品无码一区二区三区AV| 日韩一区二区三区视频| 区三区激情福利综合中文字幕在线一区亚洲视频1 | 日韩精品一区二区三区中文| 精品亚洲一区二区| 亚洲AV综合色区无码一区爱AV| 综合人妻久久一区二区精品| 中文字幕Av一区乱码| 看电影来5566一区.二区| 国产精品伦一区二区三级视频| 亚洲色无码一区二区三区| 中文字幕精品无码一区二区三区 | 亚洲AV本道一区二区三区四区 | 精品在线一区二区三区| 影院无码人妻精品一区二区| 中文字幕无线码一区| 亚洲国产精品一区二区久久| 中文字幕一区一区三区| 日韩成人一区ftp在线播放| 免费无码一区二区| 99久久国产精品免费一区二区 | 亚洲av一综合av一区| 日韩在线一区二区| 精品国产免费观看一区 | 亚洲电影国产一区|