[英]How can I make a vertical line change opacity from top to bottom of a line
I want to make a line which should change its opacity along the line from one end to another using HTML or CSS or JS. 我想制作一条线,使用HTML或CSS或JS将其不透明度从一端更改为另一端。 The line should start with less opacity and should end with high opacity or vice versa.
该行应以较低的不透明度开始,并应以较高的不透明度结束,反之亦然。
or 要么
The line should start and end with less opacity and should have high opacity in the middle of the line. 该行应启动和更低的透明度结束,并应在该行的中间高不透明度。
Essentially, what you need is a gradient line. 本质上,您需要的是一条渐变线。 Here's an example of such a CSS:
这是此类CSS的示例:
hr.name-of-your-vertical-line {
border : 0;
height : (height)px; /*your own value to suit your content*/
width : 1px;
background-image: -webkit-linear-gradient(top, #color1, #color2, #color3);
background-image: -moz-linear-gradient(top, #color1, #color2, #color3);
background-image: -ms-linear-gradient(top, #color1, #color2, #color3);
background-image: -o-linear-gradient(top, #color1, #color2, #color3);
background-image: linear-gradient(top, #color1, #color2, #color3);
}
You can read more about gradients here 您可以在此处阅读有关渐变的更多信息
Here's a JSFiddle example you can look at 这是一个JSFiddle示例,您可以看一下
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.