はのは、次のユースケースを想定してみましょうスタイル:は、自動的に別のdiv要素内にあるdiv要素をセンタリングする方法
.container {
width: 500px; /*this can also change */
}
.container .centerElem{
margin-right: auto /*unfortunately, it works only if I set properly the width*/
margin-left: auto /*unfortunately, it works only if I set properly the width*/
}
は今のところ、それは次のように動作します。
||the width of this div could be variable| |
そして、私は内側のdiv要素の幅を知らなくても、このように作業したいと思います:
| |the width of this div could be variable| |
マイナス内側の要素は、(並んで)内部の2要素を持っていることを無視するので、同様
。すべての違いを生み出します。 – Joonas