2016-07-18 13 views
0

Chrome 51.0.2704.103Firefox 47.0.1のコードスニペットの動作が異なります。幅が100%でdiv内の絶対位置が

これがなぜ発生するのか説明してください。どこで行動が正しいのか、そうでないのはなぜ、そう思うのか。ありがとう。

div, 
 
td { 
 
    border: 1px solid black; 
 
} 
 
.container { 
 
    position: absolute; 
 
} 
 
.w100Pc { 
 
    width: 100%; 
 
} 
 
.nowrap { 
 
    white-space: nowrap; 
 
}
<div class="container"> 
 
    <div>Modal dialog header</div> 
 
    <table> 
 
    <tr> 
 
     <td class="w100Pc">rest of space column</td> 
 
     <td class="nowrap">content based width column</td> 
 
    </tr> 
 
    </table> 
 
    <div>Here goes main content what should stretch "container" width</div> 
 
    <div>Modal dialog footer</div> 
 
</div>

+1

あなたは何が起こると思いますか? –

+0

主な考え方は、モーダルダイアログ内のスペースを2つの列に分割することです。 2番目の列のためのスペースは、その内部内容から相対的に計算されます。最初の列のスペースはモーダルダイアログの残りの幅です – Mrusful

+0

なぜテーブルですか? –

答えて

0

ブラウザ違った私は、彼らは別の基準に従うので、私はFirefoxがあなたの例では、現在のコードをレンダリングしていると、それだけで追加両方のブラウザで同じに見えるように考えることだと思うのコードをレンダリングdisplay:block;

div, 
 
td { 
 
    border: 1px solid black; 
 
} 
 
.w100Pc { 
 
    display:block; 
 
    width: 100%; 
 
    font-family:'Times New Roman'; 
 
} 
 
.container { 
 
    position: absolute; 
 
    left: 200px 
 
}
<div style="position: absolute; left:200px"> 
 
    <table class="w100Pc"> 
 
    <tr> 
 
     <td class="w100Pc"> 
 
     w100Pc 
 
     </td> 
 
     <td>buttons</td> 
 
    </tr> 
 
    </table> 
 
</div>

関連する問題