如何使用 CSS 创建此效果?新拟态或玻璃态
How to create this effect using CSS? neumorphism or glassmorphism
哎呀我的朋友们,我正在尝试复制这张卡但是我无法复制这个效果,你能帮我吗?我相信它与盒子阴影和线性或径向有关。
但是我离不开这个效果
很难看出此处应用的确切效果,因为您的屏幕截图像素化程度很高,但这可能就是您要查找的内容:(运行 代码片段)
body {
align-items: center;
background: #afd275;
display: grid;
grid-gap: 2rem;
grid-template-columns: 200px;
height: 100vh;
justify-content: center;
padding: 1rem;
}
.element {
align-items: center;
background: linear-gradient(-45deg, rgba(0,0,0,0.22), rgba(255,255,255,0.25));
box-shadow: 12px 12px 16px 0 rgba(0, 0, 0, 0.25),
-8px -8px 12px 0 rgba(255, 255, 255, 0.3);
border-radius: 50px;
display: flex;
height: 200px;
justify-content: center;
width: 200px;
}
.element-1 {
background: #afd275;
}
.element-2 {
background: linear-gradient(-45deg, rgba(0,0,0,0.22), rgba(255,255,255,0.25));
}
.element-3 {
background: linear-gradient(135deg, rgba(0,0,0,0.22), rgba(255,255,255,0.25));
}
@media (min-width: 700px) {
body {
grid-template-columns: repeat(3, 200px);
}
}
<body>
<div class="element element-1">Flat</div>
<div class="element element-2">Convex</div>
<div class="element element-3">Concave</div>
</body>
哎呀我的朋友们,我正在尝试复制这张卡但是我无法复制这个效果,你能帮我吗?我相信它与盒子阴影和线性或径向有关。 但是我离不开这个效果
很难看出此处应用的确切效果,因为您的屏幕截图像素化程度很高,但这可能就是您要查找的内容:(运行 代码片段)
body {
align-items: center;
background: #afd275;
display: grid;
grid-gap: 2rem;
grid-template-columns: 200px;
height: 100vh;
justify-content: center;
padding: 1rem;
}
.element {
align-items: center;
background: linear-gradient(-45deg, rgba(0,0,0,0.22), rgba(255,255,255,0.25));
box-shadow: 12px 12px 16px 0 rgba(0, 0, 0, 0.25),
-8px -8px 12px 0 rgba(255, 255, 255, 0.3);
border-radius: 50px;
display: flex;
height: 200px;
justify-content: center;
width: 200px;
}
.element-1 {
background: #afd275;
}
.element-2 {
background: linear-gradient(-45deg, rgba(0,0,0,0.22), rgba(255,255,255,0.25));
}
.element-3 {
background: linear-gradient(135deg, rgba(0,0,0,0.22), rgba(255,255,255,0.25));
}
@media (min-width: 700px) {
body {
grid-template-columns: repeat(3, 200px);
}
}
<body>
<div class="element element-1">Flat</div>
<div class="element element-2">Convex</div>
<div class="element element-3">Concave</div>
</body>