html磨砂效果,CSS - 磨砂玻璃效果

css

@import url("https://fonts.googleapis.com/css?family=Rajdhani:300&display=swap");

body, html {

height: 100%;

margin: 0;

padding: 0;

}

body {

display: flex;

justify-content: center;

align-items: center;

background-image: url("https://picsum.photos/id/124/1920/1080");

background-size: cover;

background-position: center;

font-family: 'Rajdhani', sans-serif;

}

*, *:before, *:after {

box-sizing: border-box;

}

.glass {

height: 100%;

width: 100%;

background-image: url("https://picsum.photos/id/124/1920/1080");

background-size: cover;

background-position: center;

clip-path: inset(10em);

filter: blur(20px);

display: flex;

justify-content: center;

align-items: center;

}

.drop-shadow {

height: 100%;

width: 100%;

filter: drop-shadow(0px 20px 10px rgba(0, 0, 0, 0.3));

display: flex;

justify-content: center;

align-items: center;

}

.drop-shadow:before {

display: block;

content: "";

position: absolute;

top: 10em;

height: calc(100% - 20em);

width: calc(100% - 20em);

border-top: 2px solid rgba(225, 225, 225, 0.2);

border-left: 1px solid rgba(225, 225, 225, 0.1);

border-right: 1px solid rgba(225, 225, 225, 0.3);

z-index: 2;

}

.drop-shadow > span {

position: absolute;

z-index: 5;

color: white;

font-size: 4em;

letter-spacing: 0.75em;

padding-left: 0.375em;

}

@media (max-width: 980px) {

.glass {

clip-path: inset(5em);

}

.drop-shadow:before {

top: 5em;

width: calc(100% - 10em);

}

.drop-shadow > span {

font-size: 4em;

}

}

@media (max-width: 640px) {

.drop-shadow > span {

font-size: 2em;

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的磨砂效果登录界面的HTMLCSS代码示例: HTML代码: ``` <!DOCTYPE html> <html> <head> <title>磨砂效果登录界面</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="container"> <h1>登录</h1> <form> <label for="username">用户名</label> <input type="text" id="username" name="username" required> <label for="password">密码</label> <input type="password" id="password" name="password" required> <input type="submit" value="登录"> </form> </div> </body> </html> ``` CSS代码: ``` body { background-image: url('https://images.unsplash.com/photo-1519681393784-d120267933ba'); background-size: cover; background-position: center; } .container { background-color: rgba(255,255,255,0.7); margin: 100px auto; max-width: 400px; padding: 40px; border-radius: 10px; box-shadow: 0 0 10px rgba(0,0,0,0.3); } h1 { text-align: center; margin-bottom: 20px; } form { display: flex; flex-direction: column; } label { font-weight: bold; margin-bottom: 10px; } input { padding: 10px; margin-bottom: 20px; border-radius: 5px; border: none; } input[type="submit"] { background-color: #4CAF50; color: white; cursor: pointer; } ``` 其中,`background-image`属性设置了页面的背景图片,`background-size`属性设置了背景图片的大小为cover,`background-position`属性设置了背景图片的位置为中间。`.container`类设置了登录框的样式,包括背景颜色,边距,最大宽度,内边距,边框半径和阴影。`form`元素和`label`元素设置了登录表单的样式,`input`元素设置了输入框的样式,`input[type="submit"]`元素设置了登录按钮的样式。最终实现了一个简单的磨砂效果登录界面。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值