私は、隣に座っている2つのdivがあり、1つは左にフローティングされ、もう1つは右にフローティングされています。利用可能なスペースに基づいてネストされたdivのサイズを変更します
左の浮動小数点div内には、別の3つの入れ子divがあります。
ネストされたdivが、右側のfloat divから残っている空き領域を占有するように、その幅を調整します。
この魔法はどうすればいいですか?
はここcodepen例を参照してください:ここではhttp://codepen.io/bennygill/pen/bZkJyV
はHTMLである:ここでは
<div class="outer">
<div class="inner-left">
<div class="item">Image and text here. I want all three of these to sit next too each other. But their width should adjust too fill the available space next to the blue "inner-right" content.</div>
<div class="item">Image and text here. I want all three of these to sit next too each other. But their width should adjust too fill the available space next to the blue "inner-right" content.</div>
<div class="item">Image and text here. I want all three of these to sit next too each other. But their width should adjust too fill the available space next to the blue "inner-right" content</div>
</div>
<div class="inner-right">
Some other divs and tables go in here. The width of this part will exapand based on the dynamic content it contains.
</div>
</div>
はCSSです:
/* Maximum width of container */
.outer {
width: 1000px;
}
/* Floats div container to the left */
.inner-left {
float: left;
display: inline-block;
}
/* Floats div container to the right */
.inner-right {
float: right;
width: initial;
display: inline-block;
border: 5px solid blue;
}
/* ??? helpe me position these equally in available space ??? */
.item {
width: 30%; /* This is wrong because they don't adjust to fill the space next to the blue "inner-right" content*/
text-align: center;
display: inline-block;
border: 5px solid red;
}
これはすべてを同じ行に置きますが、赤色のボックスは、青色のボックスから残りのスペースをすべて取り込むために縮小していません。青いボックスは必要に応じて展開する必要があり、赤いボックスは残りのスペースを埋めるために縮小します。 – bennygill
実際はあなたのソリューションは機能します。私はちょうどこれをテストするときに私のライブサイト上の内部要素の順序を台無しにしました。ありがとう! – bennygill
1つの問題 - モバイルレスポンスではありません。それを修正する方法はありますか? – bennygill