transition-property属性改变元素背景色。
标签: transition-property属性改变元素背景色。 Html/CSS博客 51CTO博客
2023-06-17 18:24:18 257浏览
transition-property属性改变元素背景色。,使用transition-property属性当鼠标移动到颜色块上背景颜色由红色变成了蓝色。
未使用transition-property属性前

使用transition-property属性后面

代码如下:
<html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>transition-property属性</title>
<style type="text/css">//引用css文件
div{
width:400px;//宽度为400px
height:100px;//高度为100px
background-color:red;/背景颜色为红色
font-weight:bold;//字体加粗
color:#FFF;
}
div:hover{
background-color:blue;
/*指定动画过渡的CSS属性*/
-webkit-transition-property:background-color;
-moz-transition-property:background-color;
-o-transition-property:background-color;
}
</style>
</head>
<body>
<div>使用transition-property属性改变元素背景色</div>
</body>
</html>
好博客就要一起分享哦!分享海报
此处可发布评论
评论(0)展开评论
暂无评论,快来写一下吧
展开评论
您可能感兴趣的博客



