HTML图片链接边框半透明,请教,下图登录页如何用css实现?半透明的边框怎么做?...

谢谢各位答主的答案,参考了下,然后去学习了下css3属性box-shadow和border-image,自己写的一个demo

登录页demo

1. 背景

div铺满整个屏幕,再给div添加背景图片以达到效果

.bg-div{

background: url('/img/bg2.jpg') center;

}

2. 头像

user-4.png

添加css样式,border-radius: 50%;

3. 边框

3.1 半三角:伪元素::after

一个div,顺时针旋转45度,三角的两边是div的上、左边框,after伪元素特性置于div的下方,不会遮挡住主体的div

.box::after {

content: '';

display: block;

width: 40px;

height: 40px;

position: absolute;

top: -20px;

left: 50%;

margin-left: -21px;

border-top-left-radius: 4px;

border-left: 2px solid rgba(255,255,255, 0.3);

border-top: 2px solid rgba(255,255,255, 0.3);

transform: rotate(45deg); /*旋转45度*/*

box-shadow: inset 1px 0 0 rgba(255,255,255,0.2), inset 0 1px 0 rgba(255,255,255,0.2);

}

3.2 上边框:伪元素::before

伪元素before是一个400px*2px容器,分开的两边边框通过设置容器的box-shadow,左右内阴影

.box::before {

content: '';

display: block;

width: 400px;

height: 2px;

position: absolute;

border-top-left-radius: 4px;

box-shadow: inset 171px 0 0 0 rgba(255,255,255, 0.2), inset -171px 0 0 0 rgba(255,255,255, 0.2); /*通过内阴影实现边框效果*/

}

3.3 其余边框:border

.box{

border: 2px solid rgba(255,255,255, 0.2); /*增加半透明边框*/

border-top: 0; /*去掉上边框*/

}

4. 透明输入框

背景透明,边框半透明,添加内外渐变阴影

.form-input{

background: transparent; /*背景透明*/

border: 2px solid rgba(255,255,255,0.3); /*边框半透明*/

box-shadow: inset 0 0 4px rgba(255,255,255,0.2),0 0 4px rgba(255,255,255,0.2); /*内外渐变阴影*/

}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值