Home > Web Front-end > CSS Tutorial > How Can I Vertically Center a Div Inside a Percentage-Height Div?

How Can I Vertically Center a Div Inside a Percentage-Height Div?

Barbara Streisand
Release: 2024-12-12 20:25:14
Original
399 people have browsed it

How Can I Vertically Center a Div Inside a Percentage-Height Div?

Vertically Centering a 'div' in a Percentage Height 'div'

Can a 'div' be vertically centered within a 'div' that has a percentage height?

Answer:

Many have pondered this issue online. Here's a popular solution:

Use display: table-cell; and vertical-align: middle;. Check out this page for a usage example. (Note that this technique is not supported by Internet Explorer 6.)

The above is the detailed content of How Can I Vertically Center a Div Inside a Percentage-Height Div?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template