How CSS makes the block of adaptive width appear centered

Source: Internet
Author: User

  <Divclass= ' Footer '>            <ul>          <Li>Website Home</Li>          <Li>Company Recruitment</Li>          <Li>Contact Us</Li>          <Li>Instructor Recruitment</Li>      </ul>  </Div>
. Footer{width:100%;Height:100px;background:Black;position:fixed;Bottom:0;text-align:Center; }. Footer UL{Display:Inline-block;Color: White; }. Footer Li{Height:100px;Line-height:100px;float: Left;Margin-right:20px}

Add Text-align:center at the parent level; Although this property is only valid for inline elements, the block that needs to be centered is also set on Display:inline-block; This makes it possible to convert block-level elements into inline elements with block-level attributes, so that the text-align takes effect and the adaptive width is centered.

How CSS makes the block of adaptive width appear centered

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.