Home > Web Front-end > JS Tutorial > Unpopular method to center elements horizontally and vertically

Unpopular method to center elements horizontally and vertically

php中世界最好的语言
Release: 2018-03-12 16:42:53
Original
1311 people have browsed it

This time I will bring you the unpopular method of centering elements horizontally and vertically. What are the precautions for centering elements horizontally and vertically? Here are practical cases, let’s take a look.

<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        div{            position: absolute;            width: 400px;            height: 300px;            background: pink;            margin:auto;            left:0;            top:0;            right:0;            bottom: 0;
        }    </style></head><body>
    <div></div></body></html>
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

Notification bar script startup tool written in Python

Using flv.js and video.js A live video effect

How to use js-xlsx cell style

How to use canvas to make it easy to use Graffiti drawing board

How to use js-xlsx to merge cells

The above is the detailed content of Unpopular method to center elements horizontally and vertically. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template