valign in-depth understanding

Source: Internet
Author: User

Valign said his understanding is that since the need for its words, that is, the first must be at the same level, followed by its corresponding need to have a definite value (plus a fixed row height)

A prerequisite for a functioning

Works against the following two classes

1 Inline level: img Strong em and other unknown tags that function are added to the element

The Inline-block:input button (block does not work on it) is added to the element

2 Table-cell TD only works on its own, so it needs to be on its own to achieve the effect

Two valign and Line-height each other

1 because of the presence of a row height, as an inline element, a gap appears below

2 Elimination of voids (1) instead of a block element (2) Set the row height and font size to 0 (3) to change the default vertical mode I think the essence of the font is reserved for the bottom line height equals 0 with the top to use it

Three my understanding of the alignment baseline

Alignment of the baseline, first will be reserved, followed by a simple drawing of a line, so that the elements of the line for it, it is strictly affected by the row height

To explain the above words, in the absence of content, the edge of the box to align, when there is content, the content is aligned.

Four-center alignment

That is, the element and the parent element of the basic line +1/2 line high, to the center of it, the problem is that the font center sink caused, so the font is set to 0 is good

Vertical center of picture

valign in-depth understanding

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.