本文介绍了如何将图像左侧放在渐变条中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我想将此图片 https://s32.postimg.org/3ks1zaggl/lightbulb.png 渐变条中的[ ^ ] - 左侧。 /> 我尝试了很多但没有成功。这是我的代码... CSS I want to put this image https://s32.postimg.org/3ks1zaggl/lightbulb.png[^] in the Gradient strip - left side.I tried a lot but not succeed. Here is my code...CSS.class{background-image: url('https://s32.postimg.org/3ks1zaggl/lightbulb.png');background-repeat: no-repeat;background-size: 35px 35px;vertical-align:middle;margin:20px 0 20px 0;padding-left: 45px;display: block; height:35px;padding-top:5px;color: white;font-weight: bold;font-size:18px;/*----------------------------- Gradient Code--------------------------------*/background: -moz-linear-gradient(45deg, rgba(0,0,0,1) 0%, rgba(0,128,128,0) 100%); /* ff3.6+ */ background: -webkit-gradient(linear, left bottom, right top, color-stop(0%, rgba(0,0,0,1)), color-stop(100%, rgba(0,128,128,0))); /* safari4+,chrome */ background: -webkit-linear-gradient(45deg, rgba(0,0,0,1) 0%, rgba(0,128,128,0) 100%); /* safari5.1+,chrome10+ */ background: -o-linear-gradient(45deg, rgba(0,0,0,1) 0%, rgba(0,128,128,0) 100%); /* opera 11.10+ */ background: -ms-linear-gradient(45deg, rgba(0,0,0,1) 0%, rgba(0,128,128,0) 100%); /* ie10+ */ background: linear-gradient(45deg, rgba(0,0,0,1) 0%, rgba(0,128,128,0) 100%); /* w3c */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#008080', endColorstr='#000000',GradientType=1 ); /* ie6-9 */} HTML HTML<p class="class">hello</p> 我的尝试: 这是JSFiddle: b $ b 编辑小提琴 - JSFiddle [ ^ ] 推荐答案 这很简单。您可以在同一元素上组合背景图像和CSS3渐变。请尝试下面的代码。 Hi,It is simple. You can combine a background-image and CSS3 gradient on the same element. Please try the below code..class{background-repeat: no-repeat;background-size: 35px 35px;vertical-align:middle;margin:20px 0 20px 0;padding-left: 45px;display: block; height:35px;padding-top:5px;color: white;font-weight: bold;font-size:18px;z-index: 100;/*----------------------------- Gradient Code--------------------------------*/background: url('https://s32.postimg.org/3ks1zaggl/lightbulb.png'), -moz-linear-gradient(45deg, rgba(0,0,0,1) 0%, rgba(0,128,128,0) 100%); /* ff3.6+ */ background: url('https://s32.postimg.org/3ks1zaggl/lightbulb.png'), -webkit-gradient(linear, left bottom, right top, color-stop(0%, rgba(0,0,0,1)), color-stop(100%, rgba(0,128,128,0))); /* safari4+,chrome */ background: url('https://s32.postimg.org/3ks1zaggl/lightbulb.png'), -webkit-linear-gradient(45deg, rgba(0,0,0,1) 0%, rgba(0,128,128,0) 100%); /* safari5.1+,chrome10+ */ background: url('https://s32.postimg.org/3ks1zaggl/lightbulb.png'), -o-linear-gradient(45deg, rgba(0,0,0,1) 0%, rgba(0,128,128,0) 100%); /* opera 11.10+ */ background: url('https://s32.postimg.org/3ks1zaggl/lightbulb.png'), -ms-linear-gradient(45deg, rgba(0,0,0,1) 0%, rgba(0,128,128,0) 100%); /* ie10+ */ background: url('https://s32.postimg.org/3ks1zaggl/lightbulb.png') no-repeat, linear-gradient(45deg, rgba(0,0,0,1) 0%, rgba(0,128,128,0) 100%); /* w3c */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#008080', endColorstr='#000000',GradientType=1 ); /* ie6-9 */} 希望这会对你有帮助:)。Hope this will help you :). 这篇关于如何将图像左侧放在渐变条中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-12 03:27