2021-04-06

这篇博客探讨了CSS中的高级样式技巧,重点介绍了`transition`和`transform`属性。通过示例代码展示了如何使用`transition`实现元素背景颜色的平滑过渡,以及利用`transform`进行元素的位置和大小变换。读者将了解到如何创建动态效果,提升网页交互体验。
摘要由CSDN通过智能技术生成

css高级样式

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			.box1{
				width:200px;
				height:200px;
				background-color:pink;
				transition:all 3s linear;
			}
			.box1:hover{
				/*transform:转换*/
				/*translaex(X):水平方向位移*/
				/*translaey(y):垂直方向位移*/
				/*teanslae(x,y):水平方向位移X,垂直方向位移Y*/
				transform:translate(100px,200px);
			}
		</style>
	</head>
	<body>
		<div class="box1"></div>
	</body>
</html>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>css高级样式</title>
		<style>
			.box{
				width:200px;
				height:200px;
				background-color:red;
				/*transition:过渡*/
				/*transition:过渡属性 过渡花费的时间*/
				transition:background-color 6s;
			}
			/*鼠标悬停伪类*/
			.box:hover{
				background-color:aqua;
			}
			.box1{
				width:200px;
				height:200px;
				background-color:royalblue;
				/*transition:width 5s,background-color 5s;*/
				/*all:全部、所有的*/
				transition:all 5s linear 3s;
				/*速度:ease 慢-快-慢,默认值*/
				/*linear:匀速*/
				/*ease-in:低速开始*/
				/*ease-out:低速结束*/
				/*ease-in-out:低速开始和结束*/
			}
			.box1:hover{
				width:800px;
				background-color:salmon;
			}
		</style>
	</head>
	<body>
		<div class="box"></div>
		<div class="box1"></div>
	</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值