使用css怎么實現一個背景虛化效果?針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
HTML代碼:
<div class="login-container"> //這個div就是背景圖 <div class="beijing"></div> //這個div就是顯示的內容塊,也就是我的logo和登錄框 <div class="content"></div> </div>
CSS代碼:
.login-container{ position: relative; width: 100%; height:100%; position: relative; //利用flex布局讓內容content模塊垂直居中 display: flex; flex-direction: column; position: relative; } .beijing{ //背景圖樣式 width: 100%; height: 100%; position: absolute; left: 0px; top:0px; background: url('../../../static/img/timg (1).jpg'); background-repeat: no-repeat; background-size: cover; -webkit-filter: blur(10px); -moz-filter: blur(10px); -o-filter: blur(10px); -ms-filter: blur(10px); filter: blur(10px); } .content{ //內容圖樣式 width: 80%; height: 70%; position: absolute; z-index: 5; }
關于使用css怎么實現一個背景虛化效果問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。