<span style="background-color: rgb(255, 0, 0);"><span style="font-size:24px;">一、</span></span>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS3 transition-property属性</title>
<style type="text/css">
div
{
display:inline-block;
width:100px;
height:50px;
background-color:#14C7F3;
}
div:hover
{
height:100px;
transition-property:height;
transition-duration:0.5s ;
transition-timing-function:linear;
transition-delay:0;
}
</style>
</head>
<body>
<div></div>
</body></html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS3 transition-property属性</title>
<style type="text/css">
div
{
display:inline-block;
width:100px;
height:50px;
background-color:#14C7F3;
transition-property:height;
transition-duration:0.5s ;
transition-timing-function:linear;
transition-delay:0;
}
div:hover
{
height:100px;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
这两者的区别是一个transition写在了div里,一个写在了div:hover里,这两者的区别是,第1个是鼠标移上去,移开都有过渡效果;第2个只有鼠标移上去有过渡效果,鼠标移开时没有过渡,而是直接变化,所以一般transition是写在元素中,而不是元素的伪类里。二、
<!DOCTYPE html>
<head>
<title>CSS
3
实现鼠标移上去显示全部内容</title>
<style type=
"text/css"
>
#container
{
text-
overflow
:ellipsis;
overflow
:
hidden
;
white-space
:
nowrap
;
border
:
1px
solid
gray
;
width
:
300px
;
padding
:
20px
;
color
:raba(
0
,
0
,
0
,
0.7
);
cursor
:
pointer
;
}
#container:hover
{
white-space
:
normal
;
height
:
148px
;
background-color
:
#F2F9F9
;
transition-property:background-color,height;
transition-duration:
0.2
s ;
transition-timing-function:linear;
}
</style>
</head>
<body>