Home  >  Article  >  Web Front-end  >  Several things about CSS centering

Several things about CSS centering

高洛峰
高洛峰Original
2017-02-14 14:49:171233browse

Horizontal centering:

1: Center the inline element and center its parent block element!

2: The block element is centered, margin-left, margin-right: auto; and pay attention to the width! If the width is 100%, it cannot be seen. If the width is 100%, do you still need to center it?


Vertical centering:

One: Set padding

Two: height = line-height

Three: display :table-cell vertical-align will work.

Four: Positioning and centering Various layout positioning can be solved!

For more related articles about CSS centering, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:CSS attribute marginNext article:CSS attribute margin