HTML 过渡动画:实现线性渐变效果
我不确定您需要什么样的过渡性线性率,但是在 HTML 中创建一个基本的过渡性线性率可以使用以下代码:
<!DOCTYPE html>
<html>
<head>
<title>过渡性线性率</title>
<style>
.container {
width: 400px;
height: 400px;
position: relative;
background-color: #f2f2f2;
}
.box {
width: 100px;
height: 100px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #007bff;
color: #fff;
text-align: center;
line-height: 100px;
font-size: 24px;
cursor: pointer;
}
.box:hover {
background-color: #dc3545;
}
</style>
</head>
<body>
<div class='container'>
<div class='box'>过渡性线性率</div>
</div>
</body>
</html>
这个代码会创建一个矩形容器,里面有一个居中的按钮。当用户悬停在按钮上时,背景颜色会从蓝色平滑地过渡到红色。您可以根据需要进行更改和调整。
原文地址: https://www.cveoy.top/t/topic/oMYj 著作权归作者所有。请勿转载和采集!