英文:
How do I make glass/blur background like in windows 11 menus and apps in a html element with css?
问题
"Is there any way to make glassy/blur background element or a card in html with css which is like the start menu bg in windows 11?"
编辑:我的意思是,我能够做到模糊的背景效果,但不知道如何实现那种噪点效果,我尝试将噪点图片作为背景,但它看起来不像我想要的那种效果。噪点看起来太多了。
英文:
Is there any way to make glassy/blur background element or a card in html with css which is like the start menu bg in windows 11?
edit: I mean I am able to do it till the backdrop filter part but don't know how to get that noise effect, I tried putting a noise png as a background but it doesn't looks like the one I am trying to achieve
the noise seems too much.
答案1
得分: 3
这是一个简单的示例,请根据需要进行调整以获得更好或更合适的结果。感谢Unsplash提供测试图片。下次请尽量提问更清晰,并展示您的工作!
body {
/* 用于测试的背景图片,感谢Unsplash */
background-image: url("https://images.unsplash.com/photo-1519681393784-d120267933ba?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1124&q=100");
background-position: center;
}
.glass {
/* 用于玻璃效果的CSS,根据需要进行调整以获得更好或更合适的结果 */
backdrop-filter: blur(25px) saturate(180%);
-webkit-backdrop-filter: blur(25px) saturate(180%);
background-color: rgba(255, 255, 255, 0.57);
border-radius: 12px;
border: 1px solid rgba(209, 213, 219, 0.3);
/* <div> 大小 */
width: 400px;
height: 300px;
/* 创建漂亮的文本 */
text-align: center;
vertical-align: middle;
line-height: 300px;
font-family: cursive;
font-size: 40px;
}
<div class="glass">Hello!</div>
英文:
Here's a simple example, play with it for better or more suitable results. Thanks for Unsplash for the testing image. Next time, try to make your question more clear and show your work!
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
body {
/* Image for testing purposes, thanks for Unsplash */
background-image: url("https://images.unsplash.com/photo-1519681393784-d120267933ba?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1124&q=100");
background-position: center;
}
.glass {
/* CSS for Glass UI, play with it for better or more suitable results */
backdrop-filter: blur(25px) saturate(180%);
-webkit-backdrop-filter: blur(25px) saturate(180%);
background-color: rgba(255, 255, 255, 0.57);
border-radius: 12px;
border: 1px solid rgba(209, 213, 219, 0.3);
/* <div> size */
width: 400px;
height: 300px;
/* Make nice text */
text-align: center;
vertical-align: middle;
line-height: 300px;
font-family: cursive;
font-size: 40px;
}
<!-- language: lang-html -->
<div class="glass">Hello!</div>
<!-- end snippet -->
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论