[英]How to have multiple borders on div using css
I have searched alot, but i did not find any solution. 我已经搜索了很多,但没有找到任何解决方案。 I want to have border at bottom something like below image.
我想在底部有边框,如下图所示。 multiple border how can i have this type of border on div.
多重边框如何在div上使用这种类型的边框。 I also want to have cricle image with shadow circle like this circle image
我也想像这样的圆形图像有阴影圆圈的cicle 图像
To add border at bottom in the first image i have added this code: 为了在第一张图片的底部添加边框,我添加了以下代码:
.login-wrapper {
background-color: #fff;
padding: 20px 30px;
margin: 0 auto;
border-bottom: 1px solid #333333;
box-shadow: 0 2px 0 0 #338833, 0 2px 0 0 #883333;
}
but, It is not generating the desired output. 但是,它没有生成所需的输出。
To get the desire output for second image. 获取第二张图片的期望输出。 I have added the below code.
我添加了以下代码。
for circle image i have added this code: 对于圆圈图像,我添加了以下代码:
<div class="login-wrapper" ng-controller="loginController">
<div class="field-wrapper">
<div class="login-img-wrapper">
<img src="img/person.png" class="img-circle" />
<div class="shadow"></div>
</div>
</div>
</div>
.login-img-wrapper img {
border: 1px solid #f4f4f4;
background-color: #f4f4f4;
padding: 5px;
height: 70px;
width: 70px;
border-radious: 50%;
}
.login-img-wrapper .shadow {
background-image: linear-gradient(130deg, white 50%, transparent 40%);
opacity: .7;
z-index: 15;
position: absolute;
height: 60px;
width: 60px;
top: 0;
}
but this is not generating the same image. 但这不会生成相同的图像。 Please somebody help me.
请有人帮我。
What output i have got after aplying above defined css for second image 我在第二张图片上使用高于定义的css后得到的输出
.
。
You can try with box-shadow
: 您可以尝试使用
box-shadow
:
.border-box { background:#ff0; display:inline-block; width:200px; height:20px; box-shadow: 0 1px 0 #999, 0 2px 0 #fff, 0 3px 0 #999, 0 4px 0 #fff, 0 8px 0 #999; }
<div class="border-box"></div>
For your second image: 对于第二张图片:
.circle-image { width:200px; height:200px; display:inline-block; background:#ccc; border-radius:50%; position:relative; text-align:center; } .circle-inner { width:200px; height:200px; display:inline-block; border-radius:50%; position:relative; transform:rotate(-45deg); position:absolute; top:0; left:0; } .circle-inner:after { content:""; width:200px; height:90px; display:inline-block; background:rgba(255,255,255,.3); border-radius:200px 200px 0 0; position:absolute; top:0; left:0; }
<div class="circle-image"> <div class="circle-inner"></div> </div>
You typed the radius
spelling wrong. 您输入的
radius
拼写错误。
.login-img-wrapper img {
border: 1px solid #f4f4f4;
background-color: #f4f4f4;
padding: 5px;
height: 70px;
width: 70px;
border-radius: 50%;
}
Here is a start from where you can experiment with circle, shadow and border. 这是您可以尝试使用圆形,阴影和边框的起点。
Fiddle Demo 1 小提琴演示1
Fiddle Demo 2 (Changed border/padding for image) 小提琴演示2 (更改图像的边框/填充)
<div class="login-wrapper" ng-controller="loginController">
<div class="field-wrapper">
<div class="login-img-wrapper">
<img src="http://lorempixel.com/output/people-q-c-100-100-9.jpg" />
<div class="shadow"></div>
</div>
</div>
</div>
.login-img-wrapper {
position: relative;
height: 150px;
width: 150px;
background-color: #eee;
margin: auto;
border-bottom: 1px solid #bbb;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
.login-img-wrapper:after,
.login-img-wrapper:before {
z-index: -1;
height: 4px;
bottom: -5px;
left: 6px;
right: 6px;
background-color: #eee;
border-bottom: 1px solid #bbb;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
content:" ";
position: absolute;
}
.login-img-wrapper:after {
bottom: -3px;
left: 3px;
right: 3px;
}
.login-img-wrapper:before {
box-shadow: 0 0 10px gray;
}
.login-img-wrapper img {
border: 1px solid #f4f4f4;
background-color: #f4f4f4;
padding: 5px;
height: 90px;
width: 90px;
border-radius: 50%;
box-shadow: 0 0 10px gray;
}
.login-img-wrapper .shadow {
background: linear-gradient(130deg, white 50%, transparent 40%);
border-radius: 50%;
opacity: .7;
z-index: 15;
position: absolute;
height: 100px;
width: 100px;
top: 0;
}
Update 更新
Using the new CSS clip-path
shapes circles, ellipses, and polygons, more advanced masking and shapes can be done, though it still has bad browser support. 使用新的CSS
clip-path
形状的圆形,椭圆形和多边形,可以完成更高级的蒙版和形状,尽管它仍然对浏览器支持不佳。
Read more about it here: https://css-tricks.com/clipping-masking-css/ 在此处了解更多信息: https : //css-tricks.com/clipping-masking-css/
For even more advanced clipping/shadowing (and better browser support) I recommend to start using SVG in combination with CSS. 为了获得更高级的剪辑/阴影效果(以及更好的浏览器支持),我建议开始将SVG与CSS结合使用。
As a start here is some ways to go: Draw a crescent moon using SVG in HTML 首先,这里有一些方法: 在HTML中使用SVG绘制新月
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.