html - 如何在图像上叠加渐变
问题描述
我正在尝试在图像上覆盖以工作
我在 CSS 上失败了:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<style>
.image-wrapper{
position:relative;
display:block;
}
.image-overlay:after {
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
background:repeating-linear-gradient(
45deg,
rgba(0, 0, 0, 0.2),
rgba(0, 0, 0, 0.2) 10px,
rgba(0, 0, 0, 0.3) 10px,
rgba(0, 0, 0, 0.3) 20px
);
}
.module {
background: white;
border: 1px solid #ccc;
margin: 3%;
}
.module h2 {
padding: 1rem;
margin: 0 0 0.5rem 0;
}
.module p {
padding: 0 1rem;
}
</style>
<div class="image-wrapper">
<img height="200" width="200" src="http://s3-us-west-2.amazonaws.com/s.cdpn.io/3/old_map_@2X.png"/>
<div class="image-overlay"></div>
</div>
</body>
</html>
我希望覆盖覆盖整个图像
解决方案
推荐阅读
- java - 树结构平面文件到动态 XSLT
- python - rand.randint 一遍又一遍地返回相同的数字?
- typescript - JSON-LD TypeScript 类
- r - 我需要什么条件才能使我的情节反应?
- java - 使用套接字通过 tcp 连接进行 java 多用户语音聊天
- laravel - 结合 Laravel 和 Vuejs 时更喜欢使用什么模式
- google-cloud-cdn - 如何解决 Google Cloud CDN 和 Compute Engine 的 CORS 问题
- javascript - 在按键上将文本区域附加到另一个文本区域
- firebase-realtime-database - 在 Flutter 中查询多条件 Firebase 实时数据库
- android - 对话框显示为活动时的 OnStop() 与 OnPause()