This time to bring you fit-content to achieve the element level center, fit-content to achieve the elements of the level of attention to the center of the matter, the following is the actual case, together to see.
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:
Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!
Recommended reading:
CSS3 pointer-events use of the detailed
Using CSS to implement element centering
How Font-size-adjust properties Optimize page layout