[英]Linear gradient for more than just CSS background?
It is possible to specify linear-gradient
for the background
or background-image
CSS properties. 可以为
background
或background-image
CSS属性指定linear-gradient
。 Is it also possible to do so for the object as a whole, including borders, outline, etc.? 是否也可以对整个对象(包括边框,轮廓线等)执行此操作? Or a filter that does the same?
还是做同样的过滤器?
This is For border gradient
.. 这是用于
border gradient
..
.ps-top-to-bottom { position: relative; border-top: 3px solid black; } .ps-top-to-bottom:before, .ps-top-to-bottom:after { content: ""; position: absolute; background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#000), to(transparent)); background-image: -webkit-linear-gradient(#000, transparent); background-image: -moz-linear-gradient(#000, transparent); background-image: -o-linear-gradient(#000, transparent); background-image: linear-gradient(#000, transparent); top: -3px; bottom: -3px; width: 3px; } .ps-top-to-bottom:before { left: -3px; } .ps-top-to-bottom:after { right: -3px; }
<!-- THIS IS FOR BORDER--> <div class="ps-top-to-bottom"> <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p> </div>
#grad { background: red; /* For browsers that do not support gradients */ background: -webkit-linear-gradient(red, yellow); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(red, yellow); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(red, yellow); /* For Firefox 3.6 to 15 */ background: linear-gradient(red, yellow); /* Standard syntax */ }
<div id="grad">hola mundo</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.