开发者

CSS height problem

开发者 https://www.devze.com 2023-01-06 13:52 出处:网络
I 开发者_Python百科have this code: <div style=\"height: 500px; background: #f00; display: table;\">

I 开发者_Python百科have this code:

<div style="height: 500px; background: #f00; display: table;">
  <div style="display: table-cell;">
    <div style="display: table; height: 100%;">
      <div style="display: table-cell;">asd</div>
    </div>
  </div>
</div>

and in Opera, the div (who has height set to 100%) has a height of 19px. Why does the 100% not make it 500px in height?


<div style="height: 500px; background: #f00; display: table;">
  <div style="display: table-cell;height:100%">
    <div style="display: table; height: 100%;">
      <div style="display: table-cell;">asd</div>
    </div>
  </div>
</div>

You should set the second div height as well.


If you do

<div style="height: 500px; background: #f00; display: table;">
   <div style="display: table-cell;">
     <div style="display: table; height: 100%; background: #00f;">
       <div style="display: table-cell;">asd</div>
     </div>
   </div>
 </div>

You will see that it is the full height in Opera.

The text just won't fill the area.

0

精彩评论

暂无评论...
验证码 换一张
取 消