纯CSS实现3D效果旋转效果按钮_附源代码

46 篇文章 0 订阅
12 篇文章 0 订阅
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>3D Button hover Effects</title>
	<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
	<a href="#">
		<span>Button</span>
		<span></span>
		<span></span>
		<span>Button</span>
	</a>
</body>
</html>

CSS代码如下:

body{
	margin:100;
	padding:100;
	display:flex;
	justify-content: :center;
	align-items:center;
	min-height:100vh;
	background: #00293c;
	font-family: :sans-serif;	
}
a{
	position:relative;
	width:160px;
	height:60px;
	transform-style:preserve-3d;
	transform:perspective(500px) rotateY(25deg);
	transition:2s;
	
}
a:hover{
	transform: perspective(500px) rotateY(385deg);
}
a span{
	position:absolute;
	top:0;
	left:0;
	display:block;
	width:100%;
	height:100%;
	justify-content:center;
	align-items:center;
	font-size:24px;
	letter-spacing:2px;
	color:#333;
	text-transform:uppercase;
	box-sizing:border-box;
	background:#fff;
}
a span:nth-child(1)
{
transform:translateZ(20px);
border-left:6px solid #65cbf9;
border-right:6px solid 	#65CBF9;
}
a span:nth-child(4){
	transform:translateZ(-20px);
	border-left: 6px solid #65CBF9;
	border-right: 6px solid #65CBF9;
}
a span:nth-child(2),
a span:nth-child(3)
{
	width:40px;
	height:100%;
	background: #0095d8;
}
a span:nth-child(2){
	transform: rotateY(90deg) translateZ(140px);
}
a span:nth-child(3)
{
	transform:rotateY(90deg) translateZ(-20px);
}

效果图如下:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值