css-渐变色矩形

效果图:

代码:

html:

复制代码
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
		<title></title>
		<link rel="stylesheet" style="text/css" href="test.css">
	</head>
	<body>
		<div class="container">
			<div class="bg"></div>
		</div>
	</body>
</html>

css:

复制代码
*{
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

.container{
	width: 100vw;
	height: 100vh;
	background-image: url('https://img0.baidu.com/it/u=3091341499,2856166635&fm=253&fmt=auto&app=138&f=PNG?w=1331&h=500');
	background-repeat: no-repeat;
	background-size: cover;
	display: flex;
	justify-content: center;
	align-items: center;
}

.bg{
	width: 500px;
	height: 45px;
	background-image:
	 linear-gradient(to top, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)),
	 linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
	 border-top: 1px solid;
	 border-bottom: 1px solid;
	 border-image: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)) 1 1 stretch;;
}
相关推荐
lzb_kkk14 天前
【实习总结】Qt通过Qt Linguist(语言家)实现多语言支持
开发语言·c++·qt·1024程序员节·qt linguist·qt 语言家
Yangy_Jiaojiao22 天前
三维手眼标定
1024程序员节
guozhetao24 天前
【图论,拓扑排序】P1347 排序
数据结构·c++·python·算法·leetcode·图论·1024程序员节
lzb_kkk1 个月前
【C++】C++四种类型转换操作符详解
开发语言·c++·windows·1024程序员节
lzb_kkk2 个月前
【MFC】编辑框、下拉框、列表控件
c语言·开发语言·c++·mfc·1024程序员节
lzb_kkk2 个月前
【MFC】树控件的使用详解
开发语言·c++·windows·mfc·1024程序员节
SizeTheMoment3 个月前
List介绍
1024程序员节
开利网络3 个月前
产业互联网+三融战略:重构企业增长密码
大数据·运维·服务器·人工智能·重构·1024程序员节
wei_shuo3 个月前
从数据中台到数据飞轮:实现数据驱动的升级之路
1024程序员节·数据飞轮
玖剹4 个月前
矩阵区域和 --- 前缀和
数据结构·c++·算法·leetcode·矩阵·动态规划·1024程序员节