(转)DIV入门之流式布局:float,clear <等>
2016-12-25 16:41
666 查看
http://blog.csdn.net/kissme_a/article/details/18910991
float有三种:(注意每行的长度,如div总长度超过行长,则会下调,发生错误)!!!
float:left表示允许向左流动
float:right表示允许向右流动
float:none表示不允许流动
[css] view
plain copy
print?
//style.css
#first{
width:300px;
height:200px;
background:red;
float:left
}
#second{
width:300px;
height:200px;
background:pink;
float:right
}
#third{
width:300px;
height:200px;
background:green;
float:right
}
#four{
width:300px;
height:200px;
background:#fab;
float:left
}
[css] view
plain copy
print?
<html>
<head>
<title>div的概念</title>
<link rel = "stylesheet" href = "style.css" type = "css/style.css"/>
</head>
<body>
<div id="first">第一个div</div>
<div id="second">第二个div</div>
<div id="third">第三个div</div>
<div id="four">第四个div</div>
</body>
</html>
clear有四种
clear:none表示允许两边有浮动对象
clear:left表示不允许左边有浮动对象
clear:right表示不允许右边有浮动对象
clear:both表示不允许有浮动对象 单独成行
[css] view
plain copy
print?
//style.css
#first{
width:300px;
height:200px;
background:red;
float:left
}
#second{
width:300px;
height:200px;
background:pink;
float:right
}
#third{
width:300px;
height:200px;
background:green;
clear:left
}
#four{
width:300px;
height:200px;
background:blue;
float:right
}
[css] view
plain copy
print?
<html>
<head>
<title>div的概念</title>
<link rel = "stylesheet" href = "style.css" type = "css/style.css"/>
</head>
<body>
<div id="first">第一个div</div>
<div id="second">第二个div</div>
<div id="third">第三个div</div>
<div id="four">第四个div</div>
</body>
</html>
有些情况还是比较特殊,有点弄不明白,要是有大神给知道就大好了
float有三种:(注意每行的长度,如div总长度超过行长,则会下调,发生错误)!!!
float:left表示允许向左流动
float:right表示允许向右流动
float:none表示不允许流动
[css] view
plain copy
print?
//style.css
#first{
width:300px;
height:200px;
background:red;
float:left
}
#second{
width:300px;
height:200px;
background:pink;
float:right
}
#third{
width:300px;
height:200px;
background:green;
float:right
}
#four{
width:300px;
height:200px;
background:#fab;
float:left
}
[css] view
plain copy
print?
<html>
<head>
<title>div的概念</title>
<link rel = "stylesheet" href = "style.css" type = "css/style.css"/>
</head>
<body>
<div id="first">第一个div</div>
<div id="second">第二个div</div>
<div id="third">第三个div</div>
<div id="four">第四个div</div>
</body>
</html>
clear有四种
clear:none表示允许两边有浮动对象
clear:left表示不允许左边有浮动对象
clear:right表示不允许右边有浮动对象
clear:both表示不允许有浮动对象 单独成行
[css] view
plain copy
print?
//style.css
#first{
width:300px;
height:200px;
background:red;
float:left
}
#second{
width:300px;
height:200px;
background:pink;
float:right
}
#third{
width:300px;
height:200px;
background:green;
clear:left
}
#four{
width:300px;
height:200px;
background:blue;
float:right
}
[css] view
plain copy
print?
<html>
<head>
<title>div的概念</title>
<link rel = "stylesheet" href = "style.css" type = "css/style.css"/>
</head>
<body>
<div id="first">第一个div</div>
<div id="second">第二个div</div>
<div id="third">第三个div</div>
<div id="four">第四个div</div>
</body>
</html>
有些情况还是比较特殊,有点弄不明白,要是有大神给知道就大好了
相关文章推荐
- Div入门之流式布局:float,clear <等>
- DIV+CSS布局入门示例(四)页面顶部 列表<li>制作菜单
- <div class="clear"></div>
- Div+CSS布局入门教程--页面制作-用好border和clear
- <div+css页面布局课堂笔记>1---div+css对页面布局的优势
- <转载>如何解决子级用float浮动父级div高度不能自适应的问题
- <div style=\'clear:both\'></div>
- <div>重叠导致布局问题(1)
- <转载>Div+Css布局教程(-)CSS必备知识
- DIV+CSS布局入门示例(五)border和clear
- Div+CSS布局入门教程之五:页面制作-用好border和clear
- <div>和<table>元素的布局
- 使用<frameset><frame/><frame/></frameset> 布局页面 (div+css布局 和frameset布局,两种并列策略)
- Div+css布局之<img>和<a>底部对齐
- 页面布局:div之float,clear特性
- HTML>精通CSS DIV网页样式与布局>理解CSS定位和DIV布局>float属性的自我理解
- <div+css页面布局课堂笔记>2---页面布局的盒子模型
- HTML使用<span>和<div>布局中遇到的问题
- <转载>div+css布局教程之div+css常见布局结构定义