"HTML" "10" div layout [div horizontal vertical Center]

Source: Internet
Author: User

Must-see reference:

Http://www.jb51.net/css/28259.html

Align Div Center
The abbreviated form is:
. style{margin:0 Auto;}
The number 0 indicates that the top bottom margin is 0. Can be set to a different value as needed.
Example:

1  2<! DOCTYPE HTML Public"-//W3C//DTD XHTML 1.0 transitional//en" "HTTP://WWW.W3.ORG/TR/XHTML1/DTD/XHTML1-TRANSITIONAL.DTD">3"http://www.w3.org/1999/xhtml"lang="ZH-CN">45<meta http-equiv="Content-type"Content="text/html; charset=gb2312"/>6<title> Center div Presentation Effect </title>7<style type="Text/css">8. align-center{9Margin0Auto/*centering this is necessary, and other properties are not required*/ Tenwidth:500px;/*to the width of the top to the browser on both sides of the center can not see the effect*/  Onebackground:red;/*Background Color*/  AText-align:center;/*text and other content centered*/  - }  -</style> the -<body> -<divclass="Align-center"> Center div Presentation Effect </div> -</body> +

You can also add a property to the body: body{text-align:center;}
In addition, the content within the DIV (including text and images) centered code is: text-align:center;

(Horizontal vertical center)

1<title> Horizontal Vertical Center div presentation Effect </title>2<style type="Text/css">3. align-center{4position:fixed; Left:%;top:2%;margin-left:width/; margin-top:height/ 2 ;5 } 6</style>78<body>9<divclass="Align-center"> Horizontal Vertical Center div presentation Effect </div>Ten</body> One

Ok

"HTML" "10" div layout [div horizontal vertical Center]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.