Home >Web Front-end >HTML Tutorial >How to keep the content position of the html page centered and not change when the browser shrinks_html/css_WEB-ITnose

How to keep the content position of the html page centered and not change when the browser shrinks_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:13:442815browse

I want the positioning effect of the things in the htm page I wrote to be like: http://www.diandian.com/register

Even if the browser is zoomed out, it is still in the middle. How to do it? Please guide me


Reply to the discussion (solution)

Use css positioning to set the width, length and position of the div

Get the length and width of the browser and try to calculate it

If your middle content is contained in a div, set this div margin: 0 auto; if the height and width are determined, position: absolute ; left: 50%; top: 50%; margin-top: - average height; margin-left: - average width; note that there is a negative sign (-) in front; I still don’t understand, please post an in-site message

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