"2019-09-21_CSS增加圖片遮罩"
Bootstrap 4.1.1 Snippet by john8895

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="pic"> <img src="https://picsum.photos/600/600/?random=1"> </div>
.pic { position: relative; width: 600px; height: 600px; } .pic::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5) /* background: linear-gradient(90deg,rgba(255, 255, 255, 0.5),rgba(255, 255, 255, 1) 75%); */ }

Related: See More


Questions / Comments: