如何在 CSS 中为线性渐变添加角度
cssweb developmentfront end technology更新于 2024/7/11 3:56:17
使用 linear-gradient() 为线性渐变添加角度。您可以尝试运行以下代码来实现将角度设置为 0 度、90 度和 -90 度。
示例
<!DOCTYPE html>
<html>
<head>
<style>
#demo1 {
height: 100px;
background: linear-gradient(0deg, orange, blue);
}
#demo2 {
height: 100px;
background: linear-gradient(90deg, orange, blue);
}
#demo3 {
height: 100px;
background: linear-gradient(-90deg, orange, blue);
}
</style>
</head>
<body>
<h2>Linear Gradients</h2>
<div id = "demo1">0 degree</div><br>
<div id = "demo2">90 degrees</div><br>
<div id = "demo3">-90 degrees</div>
</body>
</html>
相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

