好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Height100%的问题_html/css_WEB-ITnose

声明文档模式后,在IE中以下代码height 100%达不到效果。
1.不采用header中注释的方法;
2.不采用给定的高度。
有什么好的方法吗?求助!




-->
无标题页
























123










回复讨论(解决方案)

html,body{height:100%;} 

html,body{height:100%;} 



这个试过的,没用。


html,body{height:100%;} 



这个试过的,没用。




IE6
http://HdhCmsTestcnblogs测试数据/huangyong8585/archive/2013/02/05/2893058.html


html,body{height:100%;} 



这个试过的,没用。





html,body{height:100%;} 



这个试过的,没用。




IE6
http://HdhCmsTestcnblogs测试数据/huangyong8585/archive/2013/02/05/2893058.html



第二种方法确实有效,不过我在问问题的时候已经提前说明了,不采用给定的固定高度,也不能破坏现有的代码结构(去除doctype的声明)。
第一种方法与问的问题不同,问题中是Table,并且td是跨行的,尝试用这种方法并未实现。

哦.那就不用height:100%,这个属性只有在父级定义高度的情况下才有效.

你就position:absolute;top:50%,之后再根据内容块的高度写margin-top:- 内容块高度1/2

哦.那就不用height:100%,这个属性只有在父级定义高度的情况下才有效.

你就position:absolute;top:50%,之后再根据内容块的高度写margin-top:- 内容块高度1/2



也不能用绝对定位,第二行里的内容是可变的,并且这种TABLE会有很多。
其实我想实现的功能很简单,就是给多个TABLE的td添加两条不同颜色的左边框线。如果只是一条,倒也省事了。

td:nth-child(odd){border-left:2px solid red}td:nth-child(even){border-left:2px solid blue} 


    无标题页  /*CSS3 nth-child() 选择器*/td:nth-child(odd){border-left:2px solid red}td:nth-child(even){border-left:2px solid blue}    /*$(document).ready(function(){	$("#mytable").find("td").css("border-left", "2px solid red");	$("#mytable").find("td:odd").css("border-left", "2px solid blue");});*/                            	          

td:nth-child(odd){border-left:2px solid red}td:nth-child(even){border-left:2px solid blue} 


    无标题页  /*CSS3 nth-child() 选择器*/td:nth-child(odd){border-left:2px solid red}td:nth-child(even){border-left:2px solid blue}    /*$(document).ready(function(){	$("#mytable").find("td").css("border-left", "2px solid red");	$("#mytable").find("td:odd").css("border-left", "2px solid blue");});*/                            	          



这不对的,是实现一列有两条不同颜色的左边框线,所以我上面代码用了单列跨两行,可以将header中我注释的部分放开看下,截图效果:

查看更多关于Height100%的问题_html/css_WEB-ITnose的详细内容...

  阅读:37次