'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block
(略)
If all of the above have a computed value other than 'auto', the values are said to be "over-constrained" and one of the used values will have to be different from its computed value. If the 'direction' property of the containing block has the value 'ltr', the specified value of 'margin-right' is ignored and the value is calculated so as to make the equality true.
10.3.3 Block-level, non-replaced elements in normal flow | Visual formatting model details
勝手訳:
'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = 包含ブロックの幅
(略)
上記すべてが'auto'以外である場合, それらの値は「制限しすぎ("over-constrained")」と呼ばれ、そのうち一つは設定された値と違う値が取られます。もし'direction'プロパティが'ltr'であるなら、'margin-right'の設定値は無視され、上記等式が成り立つように計算されます。
ということなので、ご提示のコードについてwidth: 100%;
をwidth: auto;
などとすれば、お望みの結果になるのではないかと思います。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2020/01/29 09:35
2020/01/29 12:03
退会済みユーザー
2020/01/30 00:08
2020/01/30 00:34 編集