Reputation: 1097
What am I doing bad?
CSS:
.submit{
padding-left:10px;
margin:0;
border:0;
outline: 0;
height:32px;
padding-right:32px;
}
.green-btn {
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#61A801), to(#8CC400));
background: -webkit-linear-gradient(top, #8CC400, #61A801);
background: -moz-linear-gradient(top, #8CC400, #61A801);
background: -ms-linear-gradient(top, #8CC400, #61A801);
background: -o-linear-gradient(top, #8CC400, #61A801);
color: #fff;
font-family: verdana;
font-size: 13px;
font-weight: normal;
border-radius:5px;
}
.clipboard{
background-image: url(http://cdn1.iconfinder.com/data/icons/opensourceicons/32/Scissors.png) no-repeat right center;
}
HTML:
<input type="submit" value="Copy" class="submit green-btn clipboard">
JSFiddle: http://jsfiddle.net/77NYA/
Upvotes: 2
Views: 9450
Reputation: 2189
in your .clipboard class remove -image and make it
.clipboard { background: url(http://cdn1.iconfinder.com/data/icons/opensourceicons/32/Scissors.png) no-repeat right center;
}
because 'no-repeat' is value of background-repeat and and 'right center' is value of background-position, and you are using these values in background-image .
so syntex is background: image-src repeat-value image-position
Upvotes: 0
Reputation: 54719
You cannot specify the position and repeat values inside the background-image
property. You can only specify the URL to the image. You'll have to separate them out like this:
.clipboard {
background-image: url(http://cdn1.iconfinder.com/data/icons/opensourceicons/32/Scissors.png);
background-repeat: no-repeat;
background-position: right center;
}
Also note: Some browsers (I don't know which ones) don't allow gradients and background images to be combined together.
Here's an alternate solution using a <button>
with an <img>
inside it:
<button type="submit" value="Copy" class="submit green-btn">
<img src="http://cdn1.iconfinder.com/data/icons/opensourceicons/32/Scissors.png" alt="[scissors]" />
Copy
</button>
.submit{
padding-left:10px;
margin:0;
border:0;
outline: 0;
height:32px;
line-height:32px;
padding-right:10px;
}
.green-btn {
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#61A801), to(#8CC400));
background: -webkit-linear-gradient(top, #8CC400, #61A801);
background: -moz-linear-gradient(top, #8CC400, #61A801);
background: -ms-linear-gradient(top, #8CC400, #61A801);
background: -o-linear-gradient(top, #8CC400, #61A801);
color: #fff;
font-family: verdana;
font-size: 13px;
font-weight: normal;
border-radius:5px;
}
.green-btn img {
float: right;
margin-left: 10px;
}
And the jsFiddle preview. Feel free to play with the margins and stuff to make it look more how you want.
Upvotes: 9
Reputation: 2004
The linear gradient will be overridden by your background-image once you fix the background-image property.
Best way to do this is to create a div and use linear-gradient on it. Create 2 child elements one which will contain text and other which will contain the icon as background. Make the div behave like a submit button using jquery.
Upvotes: 1
Reputation: 464
You have to use background: url(...) instead of background-image
Upvotes: 1