Vertical Horizontal Center

Source: Internet
Author: User

Vertical Horizontal Center


This is the body code.

  1. Vertical Horizontal Center


Parse: Parent element relative child element Absolute, child element set wide height, top and left set to 50%,margin-top and Margin-left set to half of height width multiplied by-1.

2. Center horizontally:

Method 1:margin:0 Auto;

Method 2:

Parse: Parent element relative, child element Absolute, child element set width, Left:50%;margin-left: Half of width multiplied by-1;

3. Center vertically:

Parse: Parent element relative, child element Absolute, child element set height, Top:50%;margin-top: Half of width multiplied by-1;

  • Related Article

    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.