html - 怎么让两个div没有平分宽度的功能吗?
本文介绍了html - 怎么让两个div没有平分宽度的功能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
哎,写后端,写写写,搞得被前端累死...请问下面怎么让他们平分父类的宽度呢,不会要写死那个宽度把?我怎么知道屏幕宽度呢?
我这样写,是换行的效果。
<div data-options="region:'north',border:false" style="height:60px;background:#dfbf7f;">
<div style="margin-left: 30px;float: left;width: 50%;"><h1>后台管理系统</h1></div>
<div style="margin-right: 20px;float: right;width: 50%;font-size: 20px;">登陆者:</div>
</div>
解决方案
margin-left会让下面那个div换行的;去掉margin可以写成这样:
<div data-options="region:'north',border:false" style="height:60px;background:#dfbf7f;">
<div style="float: left;width: 50%;"><h1>后台管理系统</h1></div>
<div style="float: right;width: 50%;font-size: 20px;">登陆者:</div>
</div>
这篇关于html - 怎么让两个div没有平分宽度的功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文