`
yxc_gdut
  • 浏览: 95964 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

textarea IE6/7中设置百分比高度失效

    博客分类:
  • css
 
阅读更多

        大家好,我想让textarea自适应容器的高度,设置height:100%

        结果其他浏览器能自适应高度,就IE6/7不能,

        望高手指点

        

<!DOCTYPE html>
<html>
  <head>
    <title>textarea.html</title>
    <meta http-equiv="content-type" content="text/html; charset=GB18030"/>
    <style type="text/css">
    	.div{width:200px;height:200px;border:1px solid #999;padding:10px;float:left}
    	.textarea{height:100%;width:100%;overflow:auto;border:1px solid #3164ac;
    		zoom:1;
    		display:block;/*都不能让ie6、7的height:100%起作用*/
    	}
    </style>
  </head>
  <body>
	<div class="div">
	    <textarea rows="0" cols="0" class="textarea">textarea</textarea>
    </div>
	<div class="div">
	    <span class="textarea">span</span>
    </div>
	<div class="div">
	    <img class="textarea" alt="img"></img>
    </div>
	<div class="div">
	    <input class="textarea" value="input"></input>
    </div>
  </body>
</html>

   其他浏览器显示

 IE6/7显示



 

    input和textarea无效,其他inline,inline-blcok元素都有效。

    如果设置height:100px,IE6/7有效,只是设置百分比无效。

奇怪

 

  • 大小: 32.4 KB
  • 大小: 36.4 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics