CSS3新增的属性
前缀: -webkit- :safari 和 Chrome的兼容
-o- :opera的兼容
1、:hover
img{
border-radius: 50%;
transform: all 0.5s;
}
img:hover{
transform: scale(1.1);
}
<div>
<img src="img/pic4.jpg"/>
</div>
结果为:
当鼠标hover的时候,图片放大1.1倍,鼠标移出时就以0.5秒的速度缩小到最初的样式
文章首字下沉效果:
1、::first-line
p::first-line {
/* 第一行 */
color: #f0f;
font-weight: bold;
}
结果为:
2、::first-letter
p::first-letter {
/* 第一个字 */
font-size: 40px;
color: red;
float: left;
}
3、::selection(文章选中)
p span::selection {
/* background-color: ;
color: ;
text-shadow: ; */
background-color: aqua;
color: red;
}
在一个段落里面,选中后显示是样式
4、:not(class 或 id属性):表示除此以外的
5、:nth-child(odd):表示单数行 的样式
6、:nth-child(even):表示双数行当样式
7、::after / ::befor (表示在元素前/后添加)
注意:after:必须搭配 content: ’ ';使用,即使不写可为空
8、:empty(空选择器)
9、:root (根选择器)
10、:nth-child(2n-1)
11、:nth-last-child(2)
12、:nth-last-of-type(2)
13、input框的
- ::placeholder
- :checked
- :disabled (不可用)
- :read-only