Home >Web Front-end >HTML Tutorial >div css implements vertical centering compatible with Firefox and IE6_html/css_WEB-ITnose

div css implements vertical centering compatible with Firefox and IE6_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:30:241054browse

In Firefox, you can use display: table-cell; vertical-align: middle; to achieve vertical centering of divs, but in IE6, you need to use the characteristics of CSS in IE6 to achieve vertical centering. In order to achieve vertical centering compatible with Firefox and IE6, you also need to use the !important tag. Firefox supports the !important tag, while IE6 ignores the !important tag, so you can use the !important tag to distinguish Firefox and IE6. " >
                                                                   Firefox only


                   
%;">
                                                        

Vertically centered, IE6 only


                                                                lt;/div>
      

                
important; position: absolute; top: 50%;">
                                                                                                                                                                                                                                                   /p>
                                                                             < >                                                                                                                                                                  /div> : auto; margin-right: auto; IE6 uses text-align: center;
to vertically center the div. In Firefox, use display: table-cell; vertical-align: middle; to achieve vertical centering of the div. In IE6, you need to use the help of display: table-cell; vertical-align: middle; Features of CSS in IE6 enable vertical centering.
!important tag, Firefox supports !important tag, IE6 ignores !important tag

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Note: Tmall activity page development_html/css_WEB-ITnoseNext article:Note: Tmall activity page development_html/css_WEB-ITnose

Related articles

See more