为了账号安全,请及时绑定邮箱和手机立即绑定

div样式问题

div样式问题

哈尼露易丝 2015-12-25 16:30:40
怎么让几个div并排显示呢?
查看完整描述

2 回答

已采纳
?
慕莱坞9220042

TA贡献377条经验 获得超508个赞

你好,给所有的div都加上 float:left; 样式就可以了,例子:

<html>
<head>
<style type="text/css">
	.divClass{
		float:left;
	}
</style>
</head>
<body>
<div style="width:100px;height:100px;background-color:blue;" class="divClass">div1</div>
<div style="width:100px;height:100px;background-color:red;" class="divClass">div1</div>
<div style="width:100px;height:100px;background-color:gray;" class="divClass">div1</div>
</body>
</html>

望楼主采纳!

查看完整回答
反对 回复 2015-12-25
?
echo_kinchao

TA贡献600条经验 获得超86个赞

div都给inline-block就可以了

查看完整回答
反对 回复 2015-12-25
  • 2 回答
  • 2 关注
  • 1211 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信