Today through this article to introduce a Fit-content property of the relevant knowledge, CSS properties are used to center horizontally, Fit-content is CSS3 to the width property of a new attribute value, which with margin can let us easily achieve horizontal center effect; Let's see the code together.
When we let a module horizontal center The first thought is certainly margin:0 auto; So today to introduce a fit-content attribute, do not know if there are students have used, if used so you can skip this article, the students have no use to continue, I also see this property for the first time, I do not know this attribute, let alone use, originally this CSS property is used for the horizontal center , Fit-content is a new attribute value for the Width property in CSS3, which can be used to make it easy to achieve horizontal centering effect; Let's take a look at the code.
If the width is not set and the element is centered with Float:left, look at a piece of code first:
So this navigation is not centered, when we set the Fit-content plus margin to do the centering.
Currently this property only supports Chrome and Firefox browser, the following is the center of the Code: