Home  >  Article  >  Web Front-end  >  Introduction to css styles for html tags to be displayed in the center of the browser

Introduction to css styles for html tags to be displayed in the center of the browser

高洛峰
高洛峰Original
2017-03-04 15:18:441339browse

In order to meet certain needs during the layout process, it is a very common practice to center the html tag in the browser. There is a good example below. You can refer to it. css style:

The code is as follows:

<style type="text/css"> 
#login{ 
position:absolute; 
top:50%; 
left:50%; 
margin-left:-标签一半宽度; 
margin-top:-标签一半高度; 
} 
</style>


html part:

The code is as follows:

<p id="login"></p >

More html Please pay attention to the PHP Chinese website for related articles about the CSS style for displaying tags in the center of the browser!

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