CSS-DIV左中右结构

一个简单的左中右,为了做到大多的浏览器兼容却不容易。
一个工作几年的专业前台程序员不知道一些用法也是正常。

<!DOCTYPE HTML>
<html>
 <head>
  <title> New Document </title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style type="text/css">
	*{padding:0;margin:0;font: 12px/1.5 宋体;}
	html{overflow-y:scroll;}
	#all{border:5px dashed #f60;width:950px;overflow:hidden;margin:50px auto 0;}

	#left{width:50px;background:yellow;float:right;}
	#middle{width:830px;background:red;float:right;margin:0 0 0 10px;}
	#right{width:50px;background:green;float:right;margin:0 0 0 10px;}
  </style>
 </head>

 <body>
	<div id ="all">
		<div id = "left">左边</div>
		<div id = "middle">中部</div>
		<div id = "right">右部</div>
	</div>
	<br /><br /><br />
	<div style="border-style:solid;border-color:yellow red;border-width:60px;height:30px;width:30px;float:left;margin:0 10px 0 0;"></div>
	<div style="border-style:solid;border-color:yellow red;border-width:60px;height:0;width:0;float:left;margin:0 10px 0 0;"></div>
	<div style="border-style:solid;border-color:white yellow red white;border-width:60px;height:0;width:0;float:left;margin:0 10px 0 0;"></div>
		<!--
		<div style="clear:both;height:0;font-size:0;line-height:0"></div> IE6自动会给空标签约12px的高度
		-->
		<!--
		 如果注释在两个浮动代码中间,有2个以上在注释 IE6 布局混乱
		 margin:50px auto 0;  第一参数 top  最后一个参数left 
		 float:right 前面元素(整体递归)移动到下一个元素后面
		-->
 </body>
</html>
 






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值