首页 > 其他 > 详细

元素设置float属性后,其后面的元素的位置问题

时间:2017-08-21 13:18:04      阅读:263      评论:0      收藏:0      [点我收藏+]

分两种情况:

.content{
  width:350px;
  height:150px;
	color:#fff;
}
.content1,.content2{
	background-color: #00f;
}
.content2{
	margin-top:10px;
}
.one{
	background-color:#f00;
	float: left;

}
.two{
	background-color: #3dfeca;
}
.content1 .one,
.content2 .one{
	height:50px;
}

 

一,后面的元素是块级元素---block

<div class=‘content content1‘>
    	<div class=‘one‘>
		the folowing element is block;
	</div>
	<div class=‘two‘>
		second div idv idv div div div div div div div div
	</div>
 </div>

 

二,后面的元素是行内元素--inline

1 <div class=‘content content2‘>
2     <div class=‘one‘>
3     the folowing element is inline;
4     </div>
5     <span class=‘two‘>
6         inline element is span;there is other inline element such as a,i,b,em
7     </span>
8 </div>    

 

元素设置float属性后,其后面的元素的位置问题

原文:http://www.cnblogs.com/xuepei/p/7403747.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!