Firefox div高度自适应_javascript技巧

WBOY
Release: 2016-05-16 18:53:44
Original
948 people have browsed it

1.如果div想要一个最小高度,那么应该用css的minheight这个属性,但是IE不支持,考虑到大多数用户都使用IE,所以一般情况下这个属性基本上弃置不用。在IE里面,height基本上就可以当作minheight来用,因为如果内容超出height,IE会自适应其高度。但是一旦设置了 height以后,FIrefox就不会自适应div的高度了。所以只能两个属性都不用,干干净净地写

Jimbor Studio


2.即使不设置固定高度,Firefox对高度的自适应也不那么尽人意。如果需要在一个层内嵌套一个需要float来规定的层,那它就又失灵了。其实有个最简单的方法,就是在div内的最下面加一个clear:both的div。例如:

复制代码代码如下:


Jmedia Design

www.jmedia.cn





3.还有看到一个js解决的,也可以。
复制代码代码如下:


Related labels:
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!