[英]border-left height in css
I have a fiddle and I am trying to copy as it is as shown in this image . 我有一个小提琴 ,我正尝试照此 图像所示进行复制。 At this moment, I am able to put borders across an image but for some reasons I am not able to increase the height of border-left.
目前,我可以在图像上放置边框,但是由于某些原因,我无法增加左边框的高度。 I am pretty sure it will done through CSS selectors but not sure how.
我很确定它将通过CSS选择器完成操作,但不确定如何执行。 The CSS which I have used to put the borders across an image is:
我用来在图像上放置边框的CSS是:
.helmet-image1
{
position: relative;
left: 20px;
border-left: 2px solid rgb(254, 91, 31);
border-right: 2px solid rgb(254, 91, 31);
border-top: 2px solid rgb(254, 91, 31);
}
If you wrap the image in an element, you can use borders on the parent and pseudo elements of that parent element to fake a border that is a different height than the parent/image. 如果将图像包装在一个元素中,则可以在父元素和该父元素的伪元素上使用边框来伪造与父/图像高度不同的边框。
You can use bottom
to control the height, or replace bottom with height
and use something like height: calc(100% + 100px);
可以使用
bottom
来控制高度,或与取代底部height
和使用类似height: calc(100% + 100px);
div { position: relative; left: 20px; border-right: 2px solid rgb(254, 91, 31); border-top: 2px solid rgb(254, 91, 31); display: inline-block; } img { vertical-align: top; } div { position: relative; } div::after{ position: absolute; top: 0; left: 0; bottom: -100px; width: 2px; background: rgb(254,91,31); content: ''; }
<div> <img class="helmet-image1" src="https://s24.postimg.org/m3yekb9n9/i_Stock- 516143705.png"> </div>
You could solve this by putting a container outside your image, and setting the container height. 您可以通过在图像外部放置一个容器并设置容器高度来解决此问题。
.container {
border-left: 2px solid rgb(254, 91, 31);
border-right: 2px solid rgb(254, 91, 31);
border-top: 2px solid rgb(254, 91, 31);
height: 400px;
display: inline-block;
}
.helmet-image1
{
position: relative;
left: 20px;
}
<div class="container">
<img class="helmet-image1"
src="https://s24.postimg.org/m3yekb9n9/i_Stock-516143705.png">
</div>
you could use box-shadow
on img tag eventually: 您最终可以在img标签上使用
box-shadow
:
img { padding: 5px;/*optionnal */ vertical-align: top;/*optionnal */ box-shadow: -2px -2px rgb(254, 91, 31), 0 171px white, -2px 170px rgb(254, 91, 31), 2px -2px rgb(254, 91, 31), 2px -1px rgb(254, 91, 31), 0px -2px rgb(254, 91, 31); border-radius: 5px 5px 0 0/*optionnal */ } /* demo purpose for small snippet */ body {min-height:400px;}
<img class="helmet-image1" src="https://s24.postimg.org/m3yekb9n9/i_Stock- 516143705.png"> <br/> text to test
https://jsfiddle.net/9b7uaoj2/15/ https://jsfiddle.net/9b7uaoj2/15/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.