How to realize the centered layout of css
This article mainly introduces how to achieve the central layout of css, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Css centered layout
Central layout
Centered horizontally (width adaptive)
1.inline-block+text-align
.child {display:inline-block;/* becomes an inline block element, making the element width adaptive and does not inherit the parent element width; * /} .parent {text-align:center;}
2.table+margin
Child {display:table;/* becomes a table element, which can make the width of the element adaptive and does not inherit the width of the parent element. * / margin:0auto;} Thank you for reading this article carefully. I hope the article "how to achieve the central layout of css" shared by the editor will be helpful to you. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!