css - 让父层中的两列div同高
本文介绍了css - 让父层中的两列div同高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
怎么样父层div中的两列子div同高。
现在是一部样高,如图:
html代码如下:
<div style="margin-left: 2em;height: 17em;">
<div style="background-color: #f2f2dd;float: left;width: 20em; border-radius: 7px; margin-left: 2em;border: solid 1px">
<ul>
<ol style="font-size: 2em">联系我们</ol>
<ol style="font-size: 1.3em;margin-top: 1em;">
平台运营:xxx
</ol>
<ol>
游戏接入:xxx
</ol>
<ol>
渠道接入:xxx
</ol>
<ol>
商务联系:xxx
</ol>
</ul>
</div>
<div style="width:30em;border-radius:7px;margin-left: 1.5em;margin-right:2em;float: left;border: solid 1px;background-color: #f2f2dd;">
<div style="font-size: 2em;margin-left: 5.5em;margin-top: 0.8em;margin-bottom: 0.6em;">欢迎登录</div>
<table style="height: 7em;width: 100%;margin-left: 0px">
<tbody>
<tr>
<td ><label style="margin-left:5%">用户名:</label></td>
<td style="text-align: left"><input type="text" class="text" id="name"></td>
</tr>
<tr>
<td><label>密码:</label></td>
<td style="text-align: left"><input type="password" class="text" id="pwd"></td>
</tr>
</tbody>
</table>
<ul style="padding: 0px;margin: 1em;margin-bottom: 2em">
<!--<ol style="float: left;margin: 0px;padding: 0px;margin-left: 1em"><input type="button" value="注册新用户" onclick="window.location='register'" class="btn-base btn-register"></ol>-->
<!--<ol style="margin: 0px;padding: 0px;"><input type="button" value="登录" class="btn-base btn-login" onclick="login()" style="margin-left: 1em"></ol>-->
<ol style="margin: 0px;padding: 0px;text-align: center"><input type="button" value="登录" class="btn-base btn-login" onclick="login()" style="margin-left: 1em"></ol>
</ul>
</div>
</div>
解决方案
你的需求是这样吗?height:100%; 最简单易懂。
这篇关于css - 让父层中的两列div同高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文