私はHow are `display: table-cell` widths calculated?とブートストラップinput groupsを読んでいました。テーブルセルの幅:100%はどのように機能しますか?
https://jsfiddle.net/kb23jLL3/
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<form class="bs-example bs-example-form" data-example-id="simple-input-groups">
<div class="input-group">
<div class="input-group-addon" id="basic-addon1">@</div>
<div class="form-control" placeholder="Username" aria-describedby="basic-addon1"> </div>
</div>
</form>
次の例を考えてみましょう.form-control
は幅100%を持っていますが、それだけでcongaingテーブルで利用可能な幅を取るために成長します。ここまでは順調ですね。だから私は.form-control
がテーブルを含む限界を超えて成長することはないと思う。しかし、幅を100%以上にすると、それは包含テーブルの境界から大きくなり、幅を100%未満にすると使用可能なスペースが取れなくなります。例えば。 100%+ケース:
https://jsfiddle.net/kb23jLL3/1/
.input-group .form-control {
width: 110%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<form class="bs-example bs-example-form" data-example-id="simple-input-groups">
<div class="input-group">
<div class="input-group-addon" id="basic-addon1">@</div>
<div class="form-control" placeholder="Username" aria-describedby="basic-addon1"> </div>
</div>
</form>
あなたは、水平スクロールバーが現在表示されて見ることができます。同様に、私は幅を100%未満を与える以下の例で考えてみます。
https://jsfiddle.net/kb23jLL3/2/
.input-group .form-control {
width: 90%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<form class="bs-example bs-example-form" data-example-id="simple-input-groups">
<div class="input-group">
<div class="input-group-addon" id="basic-addon1">@</div>
<div class="form-control" placeholder="Username" aria-describedby="basic-addon1"> </div>
</div>
</form>
をなぜ、テーブルのセルに100%の幅は、使用可能な幅を意味するのでしょうか? 100%の幅は含有元素の100%を取ることを意味するのでしょうか?
http://stackoverflow.com/questions/21130221/how-are-display-table-cell-widths-calculated – Daniel
@Danielそれは私が最初にリンクされ、同じ質問です私の質問の。 – user31782
テーブル行を構想する必要があります。表のセルは、表の行を100%まで埋めます。その行内に別のテーブルセルがある場合、それはセット幅が制限されています。残りの幅は、例の2番目のテーブルセルの幅です。 'table-cell'は内容に崩壊する標準的な振る舞いをしているので、それを含んでいる要素を埋めるために100%に伸ばす必要があります。 – Daniel