欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
您的位置:DIVCSS5首页 > HTML >

 

块级元素可以通过浮动实现左右浮动,目的就是让DIV实现类似表格行和列横竖排,浮动时其他块元素会占用原来位置(对后面元素的产生影响)。后续不想浮动可以清除浮动(清除别人的浮动对我的影响!!!) clear:left right both

<div style="background-color:red; float:left;"></div>

<div style="background-color:blue; float:left;"></div>

<div style="background-color:green; float:left; "></div>

<div style="background-color:red; float:right; "></div>

<div style="background-color:blue; float:right; "></div>

<div style="background-color:green; float:right; "></div>

<!--TIPS:不希望前面的浮动对后面布局产生影响-->

<div style="width:0px; height:0px; clear:both;"></div>

<div style="background-color:yellow;"></div>

注意:

1、浮动时,设置宽高度以便控制位置,一般还要配合margin!!!

2DIV本身浮动,内部嵌套DIV也应该浮动!!!

超链接伪类:

A选择器:link{} 正常样式

A选择器:hover{} 悬停样式

A选择器:active{} 点击时样式

A选择器:visited{} 点击后样式,颜色设置不生效清除浏览器缓存即可。

<style>

.a1:link{

color:red;

text-decoration:none;

}

.a1:hover{

font-size:36px;

color:green;

}

.a1:active{

color:blue;

font-size:12px;

}

.a1:visited{

color:gray;

}

</style>

<a href="#">点击右边惊喜</a>

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html/h33433.shtml

如对文章有任何疑问请提交到DIV CSS论坛,或有任何网页制作CSS问题立即到CSS论坛发贴求解 或 直接DIVCSS5网页顶部搜索遇到DIVCSS疑问。
CSS教程文章修订日期:2018-08-14 17:37 原创:DIVCSS5
本文www.divcss5.com DIVCSS5版权所有。