How to implement CSS pop-up window centering

不言
Release: 2018-06-25 17:03:29
Original
3124 people have browsed it

The following is a simple implementation method for centering pop-up windows. The content is quite good, so I will share it with you now and give it as a reference.

When I was making pages recently, I often encountered the problem of pop-up boxes being centered.

I asked some experts around me and finally figured it out,

Principle of implementation:

1, define a pseudo class for the peripheral box: before

2, define the fixed attribute of the peripheral box

3, Define the content box.

Define peripheral box:

outbox{ position:fixed; top:0; rightright:0; bottombottom:0; left:0; display:block; text-align:center; }
Copy after login

Define peripheral box pseudo-class:

outbox:before{ content=""; width:0; height:100%; display:inline-block; vertical-align:middle; }
Copy after login

Definition content box:

contentbox{ display:inline-block; vertical-align:middle; text-align:center; }
Copy after login

All codes:

     弹窗居中  

Copy after login

The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

How to use CSS3 to match horizontal and vertical screens

The table-layout attribute of CSS usage

The above is the detailed content of How to implement CSS pop-up window centering. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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 Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!