简体   繁体   English

左边框渐变填充边框半径

[英]left border gradient fill with border radius

I have been trying to add gradient to my border-left on my table but couldnt come up with a solution for the same!我一直在尝试在我的桌子上的左边框上添加渐变,但无法想出相同的解决方案!

This is what happens这就是发生的事情

I would prerfer this where the border is curved我更喜欢边界弯曲的地方

In the second picture i commented the border image line在第二张图片中,我评论了边框图像线

  width:300px;
border-radius:20px;
box-shadow:0 0 5px rgba(0,0,0,0.2);
overflow:hidden;
font-family:"Lato",sans-serif;
font-size:16px;
line-height:1;/*originally 1.5 #9970e0*/
color:#555555;
margin: 15px;
border-left: 4px solid #9970e0  ;
border-right:0px;
border-image:linear-gradient(to bottom,#cc0099,#0099ff)1 100%;
}```
 

This is not how you will get gradient border, to get a gradient border, you will have to give a background gradient to parent element.Now if you want to get left border as gradient then give padding left to parent element and in similar fashion you can give padding to other sides as well.这不是您将如何获得渐变边框,要获得渐变边框,您必须为父元素提供背景渐变。现在,如果您想将左边框作为渐变,然后以类似的方式为父元素提供左侧填充也可以给其他边填充。

I did not touch other parts of your css declaration, just removed the border and added a padding and background color.我没有触及您的 css 声明的其他部分,只是删除了边框并添加了填充和背景颜色。

 .test{width:300px; border-radius:20px; box-shadow:0 0 5px rgba(0,0,0,0.2); overflow:hidden; font-family:"Lato",sans-serif; font-size:16px; line-height:1;originally 1.5 #9970e0 color:#555555; margin: 15px; background: linear-gradient(to bottom,#cc0099,#0099ff); border-right:0px; padding: 0 0 0 5px; }.inherit{ width: 100%; padding: 0 0 0 1px; background: #fff; }
 <div class="test"> <div class="inherit"> Inherit </div> </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM