第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何使用<div>標簽和Css創(chuàng)建表

如何使用<div>標簽和Css創(chuàng)建表

慕勒3428872 2019-08-26 10:53:10
如何使用<div>標簽和Css創(chuàng)建表我想只使用<div>標簽和CSS 創(chuàng)建表。這是我的樣本表。<body>   <form id="form1">       <div class="divTable">              <div class="headRow">                 <div class="divCell" align="center">Customer ID</div>                 <div  class="divCell">Customer Name</div>                 <div  class="divCell">Customer Address</div>              </div>             <div class="divRow">                   <div class="divCell">001</div>                 <div class="divCell">002</div>                 <div class="divCell">003</div>             </div>             <div class="divRow">                 <div class="divCell">xxx</div>                 <div class="divCell">yyy</div>                 <div class="divCell">www</div>            </div>             <div class="divRow">                 <div class="divCell">ttt</div>                 <div class="divCell">uuu</div>                 <div class="divCell">Mkkk</div>            </div>       </div>   </form></body>風格:<style type="text/css">     .divTable    {         display:  table;         width:auto;         background-color:#eee;         border:1px solid  #666666;         border-spacing:5px;/*cellspacing:poor IE support for  this*/        /* border-collapse:separate;*/     }     .divRow    {        display:table-row;        width:auto;     }     .divCell    {         float:left;/*fix for  buggy browsers*/         display:table-column;         width:200px;         background-color:#ccc;     }</style>但這個表不適用于IE7及以下版本。請給我你的解決方案和想法。謝謝。
查看完整描述

3 回答

?
心有法竹

TA貢獻1866條經(jīng)驗 獲得超5個贊

這是一個老線程,但我想我應該發(fā)布我的解決方案。我最近遇到了同樣的問題,我解決它的方法是遵循下面概述的三步法,這很簡單,沒有任何復雜的CSS。

(注意:當然,對于現(xiàn)代瀏覽器,使用table或table-row或table-cell的值來顯示CSS屬性可以解決問題。但是我使用的方法在現(xiàn)代和舊版瀏覽器中同樣有效,因為它沒有使用這些值來顯示CSS屬性。)

三步簡單方法

對于僅包含div的表,以便像在表元素中一樣獲取單元格和行,請使用以下方法。

  1. 用塊div替換表元素(使用 .table類)

  2. 用塊div替換每個tr或th元素(使用.row類)

  3. 用內聯(lián)塊div替換每個td元素(使用.cell類)

.table {display:block; }.row { display:block;}.cell {display:inline-block;}
    <h2>Table below using table element</h2>
    <table cellspacing="0" >
       <tr>
          <td>Mike</td>
          <td>36 years</td>
          <td>Architect</td>
       </tr>
       <tr>
          <td>Sunil</td>
          <td>45 years</td>
          <td>Vice President aas</td>
       </tr>
       <tr>
          <td>Jason</td>
          <td>27 years</td>
          <td>Junior Developer</td>
       </tr>
    </table>
    <h2>Table below is using Divs only</h2>
    <div class="table">
       <div class="row">
          <div class="cell">
             Mike          </div>
          <div class="cell">
             36 years          </div>
          <div class="cell">
             Architect          </div>
       </div>
       <div class="row">
          <div class="cell">
             Sunil          </div>
          <div class="cell">
             45 years          </div>
          <div class="cell">
             Vice President          </div>
       </div>
       <div class="row">
          <div class="cell">
             Jason          </div>
          <div class="cell">
             27 years          </div>
          <div class="cell">
             Junior Developer          </div>
       </div>
    </div>


查看完整回答
反對 回復 2019-08-26
  • 3 回答
  • 0 關注
  • 483 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號