Home >Web Front-end >HTML Tutorial >css 高度100%的小问题_html/css_WEB-ITnose

css 高度100%的小问题_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-21 09:00:071293browse

<div style="overflow:hidden;">    <div style="height:50px;float:left;width:100px;background:#CCC;"></div>    <div style="height:100%;float:left;width:100px;background:#808080;"></div></div>

为什么第二个div高度不能自动100%?
我该如何让并行的div 高度 为其中任意一个div最高的高度


回复讨论(解决方案)

小白求助,如何才行实现

小白求助,如何才能实现

小白求助,如何才能实现

似乎没听懂什么意思


    

    


    

    


很好, 但是这样有个问题 ,就是我的宽度不固定, 那么left 这个是不确定的

用高度调不到试着用最小高度去设置第一个DIV的高度,然后设定第二个DIV的高度。具体你有要做什么我没看懂,假如你要第一个DIV浮在第二个DIV上面那我觉得要用绝对定位。你的目的不是很明确我不是很明白


    

    


    

    


加了display: table-cell;,去掉float:left;

style="height:100%;float:left;width:100%; 尽量一样

加上这个试一下:
html,body{ height:100%;}

这么久才来结贴 抱歉额


    

    


加了display: table-cell;,去掉float:left;
这样确实可以实现效果 谢谢
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