仅模糊背景图像而不是前面的文本
生活随笔
收集整理的這篇文章主要介紹了
仅模糊背景图像而不是前面的文本
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
正如標題所說。 如何模糊容器的背景圖像而不模糊前面的文本?
<div class="card"> <div class="head"> <div class="title"> <span>Card Title</span> </div> </div> <div class="body-container"> <div class="body"> <div class="content"> <span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</span> </div> </div> </div> </div>.container a .body-container { background-image: url("https://i2.wp.com/digital-photography-school.com/wp-content/uploads/2019/02/Landscapes-01-jeremy-flint.jpg"); filter: blur(1px); }
body, html { height: 100%; margin: 0; font-family: Arial, Helvetica, sans-serif; } * { box-sizing: border-box; } .bg-image { /* The image used */ background-image: url("https://i2.wp.com/digital-photography-school.com/wp-content/uploads/2019/02/Landscapes-01-jeremy-flint.jpg"); /* Add the blur effect */ filter: blur(8px); -webkit-filter: blur(8px); /* Full height */ height: 100%; /* Center and scale the image nicely */ background-position: center; background-repeat: no-repeat; background-size: cover; } /* Position text in the middle of the page/image */ .bg-text { background-color: rgb(0, 0, 0); /* Fallback color */ background-color: rgba(0, 0, 0, 0.4); /* Black w/opacity/see-through */ color: white; font-weight: bold; border: 3px solid #f1f1f1; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2; width: 80%; padding: 20px; text-align: center; } <div class="bg-image"></div> <div class="bg-text"> <h2>Blurred Background</h2> <h1 style="font-size:50px">I am John Doe</h1> <p>And I'm a Photographer</p> </div>
轉載于:https://www.cnblogs.com/gamecenter/p/11096028.html
總結
以上是生活随笔為你收集整理的仅模糊背景图像而不是前面的文本的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ListObject 多条件去重
- 下一篇: PHP+MySQL 跨服务器跨数据库数据