最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何設(shè)置div表中列的寬度?

如何設(shè)置div表中列的寬度?

一只甜甜圈 2024-01-22 20:55:56
添加行后,設(shè)置列寬出現(xiàn)問(wèn)題。如果運(yùn)行代碼片段,可以非常清楚地看到單元格大小與指定值不匹配。在下面的情況下如何設(shè)置列的寬度?.divTable{    display: table;    width: 100%;}.divTableRow {    display: table-row;}.divTableHeading {    background-color: #EEE;    display: table-header-group;}.divTableCell, .divTableHead {    border: 1px solid #999999;    display: table-cell;    padding: 3px 10px; }.divTableHeading {    background-color: #EEE;    display: table-header-group;    font-weight: bold;}.divTableFoot {    background-color: #EEE;    display: table-footer-group;    font-weight: bold;}.divTableBody {    display: table-row-group;}<div class="divTable" style="border: 1px solid #000;"><div class="divTableBody"><div class="divTableRow"><div class="divTableCell" style="width:10%">&nbsp;</div><div class="divTableCell" style="width:40%">&nbsp;</div><div class="divTableCell" style="width:50%">&nbsp;</div></div><div class="divTableRow"><div class="divTableCell">&nbsp;</div><div class="divTableCell">&nbsp;</div><div class="divTableCell">&nbsp;</div></div><div class="divTableRow" >texttexttexttexttexttexttexttexttexttexttexttexttexttexttextte xttexttexttexttexttexttextt exttexttexttexttextt xttexttexttexttexttexttex ttexttext</div><div class="divTableRow"><div class="divTableCell">&nbsp;</div><div class="divTableCell">&nbsp;</div><div class="divTableCell">&nbsp;</div></div></div></div>
查看完整描述

3 回答

?
慕的地8271018

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超4個(gè)贊

你需要考慮table-layout: fixed;


.divTable {

  display: table;

  width: 100%;

  table-layout: fixed;

}


.divTableRow {

  display: table-row;

}


.divTableHeading {

  background-color: #EEE;

  display: table-header-group;

}


.divTableCell,

.divTableHead {

  border: 1px solid #999999;

  display: table-cell;

  padding: 3px 10px;

}


.divTableHeading {

  background-color: #EEE;

  display: table-header-group;

  font-weight: bold;

}


.divTableFoot {

  background-color: #EEE;

  display: table-footer-group;

  font-weight: bold;

}


.divTableBody {

  display: table-row-group;

}

<div class="divTable" style="border: 1px solid #000;">

  <div class="divTableBody">

    <div class="divTableRow">


      <div class="divTableCell" style="width:10%">&nbsp;</div>

      <div class="divTableCell" style="width:40%">&nbsp;</div>

      <div class="divTableCell" style="width:50%">&nbsp;</div>

    </div>

    <div class="divTableRow">

      <div class="divTableCell">&nbsp;</div>

      <div class="divTableCell">&nbsp;</div>

      <div class="divTableCell">&nbsp;</div>

    </div>


    <div class="divTableRow">texttexttexttexttexttexttexttexttexttexttexttexttexttexttextte xttexttexttexttexttexttextt exttexttexttexttextt xttexttexttexttexttexttex ttexttext</div>

    <div class="divTableRow">


      <div class="divTableCell">&nbsp;</div>

      <div class="divTableCell">&nbsp;</div>

      <div class="divTableCell">&nbsp;</div>

    </div>

  </div>

</div>


查看完整回答
反對(duì) 回復(fù) 2024-01-22
?
千巷貓影

TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超7個(gè)贊

[您修改后的代碼]


//你好,//你應(yīng)該嘗試這個(gè)


//我忘了還有一個(gè)屬性max-width,


.divTableCell, .divTableHead {

  border: 1px solid #999999;

  display: table-cell;

  overflow: hidden;

  max-width: 120px!important;


查看完整回答
反對(duì) 回復(fù) 2024-01-22
?
陪伴而非守候

TA貢獻(xiàn)1757條經(jīng)驗(yàn) 獲得超8個(gè)贊

表格必須由div組成嗎?

如果沒(méi)有,請(qǐng)使用 HTML<table>標(biāo)記并顯式設(shè)置其寬度及其顯示屬性。

然后您可以設(shè)置列的寬度:

https://codepen.io/daniel-knights/pen/KKdgYzW


查看完整回答
反對(duì) 回復(fù) 2024-01-22
  • 3 回答
  • 0 關(guān)注
  • 283 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)