CSS box-align attribute control child element Layout example Analysis

Source: Internet
Author: User
box-align Description

The Box-align property that specifies when the elements of the element are arranged vertically in a specified direction. < the order in which the neutron elements in the specified box are displayed. >
When container elements are much larger than child elements, you can use the Box-align property to specify the sort order of child elements, and you can specify how child elements are represented.
Also, the longitudinal direction of the arrangement, which can be interpreted as the configuration direction of the elements in the element, the default value is horizontal, and this property is used to arrange the vertical direction. You can also use box-orient:vertical to set the direction of the child element arrangement.

Property value
Start: The standard direction element, the upper end of each sub-feature is arranged along the upper end of the element, the remaining position is sorted downward, and the opposite element is sorted along the lower end, and the remaining positions are sorted upward. < for a normal-orientation box, the top edge of each child element is placed along the edge of the box. For boxes in the opposite direction, the lower edge of each child element is placed along the bottom of the box. >
End: The standard direction element, the lower side of each sub-feature is arranged along the lower end of the element, the remaining positions are sorted upward, and the opposing elements are sorted along the upper end, and the remaining positions are sorted down. < for normal-orientation boxes, the lower edge of each child element is placed along the bottom of the box. For a box that is in the opposite direction, the top edge of each child element is placed along the edge of the box. >
Center: The remaining space for equal distribution. < divide the extra space equally, half on the child element, and the other half below the child element. >
Baseline:inline-axis and horizontal, all child elements baseline configuration arrangement < If box-orient is Inline-axis or horizontal, all child elements are aligned with their baselines. >
Stretch: Each child element is automatically sorted according to the height of the container element (default value)

About centering
The original horizontal vertical center is written as: Height=line-height Vertical Center text-align to achieve horizontal center
Now use Box-align to achieve horizontal centering with vertical center Box-pack

<! DOCTYPE html>   

Instance Code

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 

Example diagram

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.