3

動的および静的なテーブルセルがあります。動的テーブルセルで高さ 100% の div を作成する必要があります。

最小限の解決策があります-これはChromeとFirefoxでのみ機能します。Opera & IE では、子 div のテーブル サイズがトップになります。オペラとjsなしの解決策はありますか?

良い:

良い

悪い:

ここに画像の説明を入力


更新 #1 Chrome、FF、および Opera ( Presto ) の場合:

<table class='m-table'>
    <tr>
      <td class='m-top-cell'>
        <div class="b-subtable">
          <div class="b-content"></div>
        </div>
      </td>
    </tr>
    <tr>
      <td class='m-bottom-cell'></td>
    </tr>
  </table>

.m-table {
  width: 100px;
  height: 250px;
  margin: 0 auto;
  position: relative;
  border-spacing: 0;
  padding: 0;

  border: 1px solid blue;
}

.m-top-cell {
  height: 100%;
  position: relative;

  background-color: red;
}

.m-bottom-cell {
  background-color: gold;
  height: 200px;
}

.b-subtable {
  background-color: #E76D13;
  border: 1px solid #E76D13;
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  right: 5px;
}

@-moz-document url-prefix() {
  .m-top-cell {
      padding: 5px;
  }

  .b-subtable {
    position: relative;
    display: table;
    height: 100%;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
  }

  .b-subtable:after {
    content: '. .';
    display: block;
    word-spacing: 99in;
    height: 0;
    overflow: hidden;

    font-size: 0.13em;
    line-height: 0;
  }
}

.b-content {
  background-color: orange;
  width: 15px;
  height: 15px;

  position: absolute;
  left: 10px;
  top: 10px;
}
4

1 に答える 1

0

これはうまくいくはずです:

.m-top-cell{    
    /* other css properties */
    /*remove height:100% */ 
    position:relative;

}

.b-subtable{
    /* other css properties */
    /* remove height: 100% and display: table */
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: 5px;
    right: 5px;
}

また、linkタグ表記を確認してください。

<link rel="stylesheet" href="table.css" type="text/css" />
于 2013-03-28T15:52:56.493 に答える