Setting the background image to html button? - css

I have below code to set the background image to button.
CSS:
input.hButton{
background-image: url('images/hbutton.png');
height: 21px;
width: 110px;
text-align: center;
color: #696969;
font-family: Arial,Helvetica,sans-serif;
font-size: 11px;
display:block;
}
HTML:
<input type="button" class="hButton" id="customize" value="Customize Table"></input>
Output:
Here when the button text is too long, button is split. How can I get it fixed?

Add
background-size: 100% 100%;
or find your perfect setting here:
http://www.css3.info/preview/background-size/
Btw in your case should be better:
use a gradient
use border-radius for the upper corners
use a thin border

replace your css code background-image property with this one :
background-image: url('images/hbutton.png') top repeat-y;

Hi please use the pure css code.. and remove your older method..
Fiddle:http:http://jsfiddle.net/nikhilvkd/RZ4vV/1/
What's Here?
1-Gradient
2-Border radius
3.border top,right and left
.hButton{
border:solid 1px #0e4f85;
border-bottom:none;
-moz-border-radius:5px 5px 0 0;
-webkit-border-radius:5px 5px 0 0;
border-radius:5px 5px 0 0;
padding:3px;
color:#696969;
background: #f7f5f5; /* Old browsers */
background: -moz-linear-gradient(top, #f7f5f5 0%, #e0dede 50%, #e0dede 99%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f7f5f5), color-stop(50%,#e0dede), color-stop(99%,#e0dede)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f7f5f5 0%,#e0dede 50%,#e0dede 99%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f7f5f5 0%,#e0dede 50%,#e0dede 99%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #f7f5f5 0%,#e0dede 50%,#e0dede 99%); /* IE10+ */
background: linear-gradient(to bottom, #f7f5f5 0%,#e0dede 50%,#e0dede 99%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f5f5', endColorstr='#e0dede',GradientType=0 ); /* IE6-9 */
}

Related

opacity over gradient background

I want to use opacity only for this gradient, not for text color. Here is code :
.large-thumb {
position: absolute;
bottom: 15px;
z-index: 99;
padding: 5px 5px 20px;
color: #fff;
background: #323232; /* Old browsers */
background: -moz-linear-gradient(top, #323232 0%, #858585 50%, #E7E7E7 100%) ; /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#323232), color-stop(50%,#858585), color-stop(100%,#E7E7E7)) ; /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #323232 0%,#858585 50%,#E7E7E7 100%) ; /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #323232 0%,#858585 50%,#E7E7E7 100%) ; /* Opera 11.10+ */
background: -ms-linear-gradient(top, #323232 0%,#858585 50%,#E7E7E7 100%) ; /* IE10+ */
background: linear-gradient(to bottom, #323232 0%,#858585 50%,#E7E7E7 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#323232', endColorstr='#E7E7E7',GradientType=0 ); /* IE6-9 */
width: 291px;
background:transperent;
margin-left: 20px;
margin-left: 20px;
padding-bottom: 20px;
bottom: 31px;
-moz-border-radius:25px;
-webkit-border-radius:25px;
border-radius:25px;
}
For demo follow link demo blog
basically yout text color is what it is becouse at .large-thumb span.xpose_metayou set it at #00000 insteed of #000000(6 numbers) or #000 (3 numbers).
There's no opacity around on your project.
And, if possible, next time try to extract the part of the code that it's wrong (html and css) and give it to us in your question, even better if on a jsfiddle (nice info if you don't know jsfiddle here)
Don't expect people solving your problems like: "here is my web, this is not working, fix it for me... ah, don't even expect a single please or even ty in my question"
(and yes, I'm so stupid that still I try to help)

Top border with gradient using css

I would like to put a gradient border at the top of a div.
So the start color should be #c4268c and ends with #9a0b72
<div class="bordertest"></div>
For easing here is the fiddle :http://jsfiddle.net/aKhjk/
I searched but could not find a suitable way.
you could use an image http://border-image.com/ or use a pseudo element over your border :
.bordertest {
height:300px;
width:300px;
border-top:30px solid #c4268c;
background:#000;
position:relative;
margin:1em;
}
.bordertest:first-child:before {
content:'';
position:absolute;
width:100%;
height:30px;
background:linear-gradient(to left, #c4268c, #9a0b72);
top:-30px;
left:0;
}
http://jsfiddle.net/aKhjk/1/ - jsfiddle.net/aKhjk/3
Try this, its also cross browser ready. So not so much work for you to do.
http://jsfiddle.net/cornelas/aKhjk/6/
.bordertest {
height:300px;
width:300px;
border-top:30px solid #c4268c;
/** Created at http://www.colorzilla.com/gradient-editor/ **/
background: rgb(196,38,140); /* Old browsers */
background: -moz-linear-gradient(top, rgba(196,38,140,1) 0%, rgba(154,11,114,1) 5%, rgba(0,0,0,1) 10%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(196,38,140,1)), color-stop(5%,rgba(154,11,114,1)), color-stop(10%,rgba(0,0,0,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(196,38,140,1) 0%,rgba(154,11,114,1) 5%,rgba(0,0,0,1) 10%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(196,38,140,1) 0%,rgba(154,11,114,1) 5%,rgba(0,0,0,1) 10%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(196,38,140,1) 0%,rgba(154,11,114,1) 5%,rgba(0,0,0,1) 10%); /* IE10+ */
background: linear-gradient(to bottom, rgba(196,38,140,1) 0%,rgba(154,11,114,1) 5%,rgba(0,0,0,1) 10%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c4268c', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
}
Now, you can use linear gradients with the border-image attribute in all modern browsers.
.bordertest {
color: pink;
border: 10px solid pink;
border-image: repeating-linear-gradient( 45deg, pink, pink 1%, purple 1%, purple 8%) 10;
}
See: https://css-tricks.com/almanac/properties/b/border-image/

Style Facebook share button link

I'm wondering if it's possible to style the share button link. Here's the link I would like to access (nested in Facebook's iframe).
<a class="pluginShareButtonLink" href="/sharer.php?
app_id=XXXXXXXXXXXXXXX&sdk=joey&u=http%3A%2F%2FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&
display=popup" target="_blank" id="u_0_1"><div class="blueButton blue"><div
class="pluginButton"><div><div class="pluginButtonContainer"><div
class="pluginButtonImage"><button type="submit"><i class="pluginButtonIcon img sp_25oo7a
sx_e52148"></i></button></div><span class="pluginButtonLabel">Share</span></div></div>
</div></div></a>
I've tried to change the style of the class pluginShareButtonLink as follows:
.pluginShareButtonLink:hover{
text-decoration: none;
}
And it's not working. I've also tried to change the style with jQuery but this didn't work either. Can it be done somehow?
Thanks
**You can style the button with this css and you can change the background color to any color you want.**
solution 1 (without gradient background color)
.pluginButtonContainer button{
padding: 10px;
width: 70px;
height: 35px;
background: rgb(255, 70, 70);
border: 0px!important;
border-radius: 2px;
}
solution 2 (with gradient background color)
.pluginButtonContainer button{
padding: 10px;
width: 70px;
height: 35px;
background: #ff3a3a; /* Old browsers */
background: -moz-linear-gradient(top, #ff3a3a 0%, #ff3a3a 49%, #ff402b 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ff3a3a), color-stop(49%,#ff3a3a), color-stop(100%,#ff402b)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ff3a3a 0%,#ff3a3a 49%,#ff402b 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ff3a3a 0%,#ff3a3a 49%,#ff402b 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ff3a3a 0%,#ff3a3a 49%,#ff402b 100%); /* IE10+ */
background: linear-gradient(to bottom, #ff3a3a 0%,#ff3a3a 49%,#ff402b 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff3a3a', endColorstr='#ff402b',GradientType=0 ); /* IE6-9 */
border: 0px!important;
border-radius: 2px;
}

Apply two background colors to a text box.

I have a text box which I want to apply a background colour to. Whilst I understand how to apply one background colour, I want to know what css I could apply one colour to 75% of the box and 25% of the box to another.
The best way to do it would be to use gradients.
http://www.colorzilla.com/gradient-editor/
if you not want use css3 multiple bg,
you can insert a new div in your container, who go under the content with the good bg color
on the container :
position:relative;
background:purple; /* primary color */
on the second background div :
position:absolute;
/* pos and size into the container */
left:20%;
top:20%;
width:60%;
height:60%;
background:yellow; /* secondary color */
and your initial content must be wrapped, the wrap get :
position:relative;
http://jsfiddle.net/r043v/T7gyx/
Or you can use box-shadow for that:
check this fiddle
For vertical:
.text{
-webkit-box-shadow: 0 5px #000 inset, 0 -5px #000 inset;
background: transparent;
border: 0;
}
For horizontal:
.text2{
width: 100px;
-webkit-box-shadow: 25px 0 #999 inset, -75px 0 #444 inset;
background: transparent;
border: 0;
}
Note that you can't use percentage for box shadow, so this method only works with fixed width/height if you need percentage like values.
Here is the Solution.
The HTML:
<div class="dualColor"> </div>
<div>&nbsp</div>
<input class="dualColor" type="text" />
The CSS:
.dualColor{background: #1dff00; /* Old browsers */
background: -moz-linear-gradient(left, #1dff00 0%, #1dff00 75%, #ff0004 75%, #ff0004 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#1dff00), color-stop(75%,#1dff00), color-stop(75%,#ff0004), color-stop(100%,#ff0004)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #1dff00 0%,#1dff00 75%,#ff0004 75%,#ff0004 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #1dff00 0%,#1dff00 75%,#ff0004 75%,#ff0004 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #1dff00 0%,#1dff00 75%,#ff0004 75%,#ff0004 100%); /* IE10+ */
background: linear-gradient(to right, #1dff00 0%,#1dff00 75%,#ff0004 75%,#ff0004 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1dff00', endColorstr='#ff0004',GradientType=1 ); /* IE6-9 */
height:20px; width:200px; border:none;
}
EDIT
You can apply dual colors to both the Div and the Text boxes.
Hope this helps.

CSS overlay image mask over a gradient background flashing on page load

I have a problem I'd like to solve without JavaScript-preloading. The 'jumbotron' or banner at the top of the page consists of the background gradient overlaid with an alpha masked image.
When the page below loads, the gradient background is visible for a fraction of a second before the image loads (Chrome 23 on OS/X -- with empty browser cache):
http://criticue-staging.herokuapp.com
The image is pretty small; I've tried using :before to preload the image but it doesn't seem to work.
Here's the CSS for the jumbotron:
.jumbotron {
background: #550074; /* Old browsers */
background-image: url(/images/jumbotronbg.png), -moz-linear-gradient(45deg, #550074 14%, #CC26A7 82%); /* FF3.6+ */
background-image: url(/images/jumbotronbg.png), -webkit-gradient(linear, left bottom, right top, color-stop(14%,#550074), color-stop(82%,#CC26A7)); /* Chrome,Safari4+ */
background-image: url(/images/jumbotronbg.png), -webkit-linear-gradient(45deg, #550074 14%,#CC26A7 82%); /* Chrome10+,Safari5.1+ */
background-image: url(/images/jumbotronbg.png), -o-linear-gradient(45deg, #550074 14%,#CC26A7 82%); /* Opera 11.10+ */
background-image: url(/images/jumbotronbg.png), -ms-linear-gradient(45deg, #550074 14%,#CC26A7 82%); /* IE10+ */
background-image: url(/images/jumbotronbg.png), linear-gradient(45deg, #550074 14%,#CC26A7 82%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#550074', endColorstr='#CC26A7',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}
Is there anything that can be done, preferably without JavaScript preloading?
Thank you so much in advance.
UPDATE: I also tried embedding the images but it doesn't do the trick:
Here's the full CSS:
.jumbotron {
background-color: #310046;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAUCAYAAABF5ffbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAINJREFUeNpcj8EJACEMBMOSAgQR/Nt/DVeR4Et8HhtYCBFkk6jD6Gutr/duWntvQ2vNzjkxYLLHvdfmnDFksscYw957MWSyBwtyuHUAcTIb4mS2i6OnMcyNuKiO4Vkdub06BlMc/l8XUB2ZToaYvMn06sj06ki2Z0fVqI7BrI6sfwEGADdYfUa4U86zAAAAAElFTkSuQmCC),
-moz-linear-gradient(45deg, #550074 14%, #CC26A7 82%); /* FF3.6+ */
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAUCAYAAABF5ffbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAINJREFUeNpcj8EJACEMBMOSAgQR/Nt/DVeR4Et8HhtYCBFkk6jD6Gutr/duWntvQ2vNzjkxYLLHvdfmnDFksscYw957MWSyBwtyuHUAcTIb4mS2i6OnMcyNuKiO4Vkdub06BlMc/l8XUB2ZToaYvMn06sj06ki2Z0fVqI7BrI6sfwEGADdYfUa4U86zAAAAAElFTkSuQmCC),
-webkit-gradient(linear, left bottom, right top, color-stop(14%,#550074), color-stop(82%,#CC26A7)); /* Chrome,Safari4+ */
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAUCAYAAABF5ffbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAINJREFUeNpcj8EJACEMBMOSAgQR/Nt/DVeR4Et8HhtYCBFkk6jD6Gutr/duWntvQ2vNzjkxYLLHvdfmnDFksscYw957MWSyBwtyuHUAcTIb4mS2i6OnMcyNuKiO4Vkdub06BlMc/l8XUB2ZToaYvMn06sj06ki2Z0fVqI7BrI6sfwEGADdYfUa4U86zAAAAAElFTkSuQmCC),
-webkit-linear-gradient(45deg, #550074 14%,#CC26A7 82%); /* Chrome10+,Safari5.1+ */
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAUCAYAAABF5ffbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAINJREFUeNpcj8EJACEMBMOSAgQR/Nt/DVeR4Et8HhtYCBFkk6jD6Gutr/duWntvQ2vNzjkxYLLHvdfmnDFksscYw957MWSyBwtyuHUAcTIb4mS2i6OnMcyNuKiO4Vkdub06BlMc/l8XUB2ZToaYvMn06sj06ki2Z0fVqI7BrI6sfwEGADdYfUa4U86zAAAAAElFTkSuQmCC),
-o-linear-gradient(45deg, #550074 14%,#CC26A7 82%); /* Opera 11.10+ */
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAUCAYAAABF5ffbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAINJREFUeNpcj8EJACEMBMOSAgQR/Nt/DVeR4Et8HhtYCBFkk6jD6Gutr/duWntvQ2vNzjkxYLLHvdfmnDFksscYw957MWSyBwtyuHUAcTIb4mS2i6OnMcyNuKiO4Vkdub06BlMc/l8XUB2ZToaYvMn06sj06ki2Z0fVqI7BrI6sfwEGADdYfUa4U86zAAAAAElFTkSuQmCC),
-ms-linear-gradient(45deg, #550074 14%,#CC26A7 82%); /* IE10+ */
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAUCAYAAABF5ffbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAINJREFUeNpcj8EJACEMBMOSAgQR/Nt/DVeR4Et8HhtYCBFkk6jD6Gutr/duWntvQ2vNzjkxYLLHvdfmnDFksscYw957MWSyBwtyuHUAcTIb4mS2i6OnMcyNuKiO4Vkdub06BlMc/l8XUB2ZToaYvMn06sj06ki2Z0fVqI7BrI6sfwEGADdYfUa4U86zAAAAAElFTkSuQmCC),
linear-gradient(45deg, #550074 14%,#CC26A7 82%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#550074', endColorstr='#CC26A7',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
text-align: center;
position: relative;
margin: 0;
padding: 30px 0 40px 0;
height: 300px;
-webkit-box-shadow: inset 0px -3px 3px #211;
-moz-box-shadow: inset 0px -3px 3px #211;
box-shadow: inset 0px -3px 3px #211;
margin-bottom: 30px;
}
You can set a navbar-inner to a height of 48px. The height of the image won't change, and you set the padding-top and padding-bottom as 10px. Will prevent resizing.

Resources