The following small series for everyone to bring a brief discussion on the level of CSS processing problems. Small series feel very good, now share to everyone, also for everyone to make a reference. Follow the small series together to see it, I wish you a happy game OH
1. Horizontal center Setting-inline element
Set 1 text-align:center through the parent element; To center the contents of the parent element
2. Horizontal centering Setting-Fixed width block element
The width of the block element is fixed, and the center is achieved by setting the left and right margin value "auto".
Example:
<! DOCTYPE html>
3. Horizontal Center Setting-variable width block element
Method 1. Add Table Label
Example:
<! DOCTYPE html>
Method 2. Set Display:inline; method, similar to the first, the display type is set to the inline element, and the property setting of the variable width element
Example:
<! DOCTYPE html>
Method 3. Set position:relative and left:50% to use relative positioning to offset the element to the left by 50%, which is the goal of centering
Example:
<! DOCTYPE html>
Above this article on the CSS Processing horizontal center of the problem is small part of the whole content to share to everyone, I hope to give you a reference, but also hope that we support a lot of topic.alibabacloud.com.