Why does setting the Vertical-align vertical Center not work

Source: Internet
Author: User

Why setting the Vertical-align vertical Center does not work:

The Vertical-align property may not be used too frequently, but sometimes it is possible to align the elements vertically with the Vertical-align:middle setting inside the object, but sometimes you find that this setting does not always produce an effect. The code example is as follows:

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Author"content= "http://www.softwhy.com/" /><title>Ant Tribe</title><styletype= "Text/css">TD{width:200px;Height:200px;Border:1px solid Red;vertical-align:Bottom;}Div{width:60px;Height:60px;Background-color:#690;}</style></Head><Body><Table>  <TR>    <TD><Div></Div></TD>  </TR></Table></Body></HTML>

As you can see from the above code, the Vertical-align attribute works. Take another look at the example code:

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Author"content= "http://www.softwhy.com/" /><title>Ant Tribe</title><styletype= "Text/css">. Parent{width:200px;Height:200px;Border:1px solid Red;vertical-align:Bottom;}. Children{width:60px;Height:60px;Background-color:#690;}</style></Head><Body><Divclass= "Parent">  <Divclass= "Children"></Div></Div></Body></HTML>

As you can see from the above code, the Vertical-align property here does not work. This is because this property can only be applied to elements with the Valign property, the table element has the Valign property, and the DIV element does not, so the Vertical-align property in the second example does not work.

The original address is: http://www.51texiao.cn/div_cssjiaocheng/2015/0503/587.html

The most original address is: http://www.softwhy.com

Why does setting the Vertical-align vertical Center not work

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.