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

WBOY
Release: 2016-06-24 12:30:24
Original
1034 people have browsed it

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

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template