This question already has answers here:
Does IE9 support CSS linear gradients?
(3 answers)
Closed 7 years ago.
i want to show background image, with a color over it, but color have a opacity so that background image become visible. this worked in Chrome and Firefox with linear-gradient, but not in IE9. How it can work in ie.?
linear-gradient( rgba(0, 0, 0, 0.50), rgba(0, 0, 0, 0.50) ), url(images/expand.jpg)
You can use following CSS code
note: the last line is hack for IE6 to IE9
CSS
.gradient {
background: #1e5799;
/* Old browsers */
background: -moz-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #1e5799), color-stop(50%, #2989d8), color-stop(51%, #207cca), color-stop(100%, #7db9e8));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100%);
/* IE10+ */
background: linear-gradient(to bottom, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100%);
/* W3C */
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8', GradientType=0);
/* IE6-9 *
}
Support for full multi-stop gradients with IE9 (using SVG).
Add a "gradient" class to all your elements that have a gradient, and add the following override to your HTML to complete the IE9 support:
<!--[if gte IE 9]>
<style type="text/css">
.gradient {
filter: none;
}
</style>
<![endif]-->
Single Ex:
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3B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iPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzFlNTc5OSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iIzI5ODlkOCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUxJSIgc3RvcC1jb2xvcj0iIzIwN2NjYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM3ZGI5ZTgiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(50%,#2989d8), color-stop(51%,#207cca), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%); /* IE10+ */
background: linear-gradient(to bottom, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 ); /* IE6-8 */
Related
I have a trouble with making transparent text in browsers. Here is a snippet
.title {
margin-bottom: 15px;
font-family: "Open Sans";
font-size: 87px;
font-weight: 800;
line-height: 1;
color: #fff;
text-transform: uppercase;
background: -moz-linear-gradient(to left,rgba(0,0,0,0) 0,rgba(255,255,255,0.8) 50%,#fff 100%);
background: -webkit-linear-gradient(to left,rgba(0,0,0,0) 0,rgba(255,255,255,0.8) 50%,#fff 100%);
background: linear-gradient(to left,rgba(0,0,0,0) 0,rgba(255,255,255,0.8) 50%,#fff 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
And result is:
But in IE 11 its not working how i can solve this ? Any advice ?
For IE10+ you can try with -ms-linear-gradient:
background: rgba(0,0,0,1);/* Old Browsers */
background: -moz-linear-gradient(left, rgba(0,0,0,1) 0%, rgba(255,255,255,0.5) 100%); /* FF3.6+ */
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(0,0,0,1)), color-stop(100%, rgba(255,255,255,0.5)));/* Chrome, Safari4+ */
background: -webkit-linear-gradient(left, rgba(0,0,0,1) 0%, rgba(255,255,255,0.5) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(0,0,0,1) 0%, rgba(255,255,255,0.5) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(0,0,0,1) 0%, rgba(255,255,255,0.5) 100%); /* IE 10+ */
background: linear-gradient(to right, rgba(0,0,0,1) 0%, rgba(255,255,255,0.5) 100%);/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#ffffff', GradientType=1 );/* IE6-9 */
If you like, can create this code in this tool:
https://www.cssmatic.com/gradient-generator
I have a button that has 2 different colors. I don't know about a way to color a button with 2 colors and I want to avoid from putting an image to be the background so I guess that I need 2 buttons (one under the other).
Both of the colors have to be changed when pressed (active).
Does anybody knows a way to make another button to be shown as active when the first one is pressed?
playground
<button>BUTTON</button>
button{
padding:10px 25px;
color:#fff;
border:0;
background: #1e5799; /* Old browsers */
background: -moz-linear-gradient(top, #1e5799 0%, #207cca 48%, #7db9e8 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(48%,#207cca), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #1e5799 0%,#207cca 48%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #1e5799 0%,#207cca 48%,#7db9e8 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #1e5799 0%,#207cca 48%,#7db9e8 100%); /* IE10+ */
background: linear-gradient(to bottom, #1e5799 0%,#207cca 48%,#7db9e8 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 ); /* IE6-9 */
}
button:active{
background: #b4ddb4; /* Old browsers */
background: -moz-linear-gradient(top, #b4ddb4 0%, #70aa7d 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b4ddb4), color-stop(100%,#70aa7d)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #b4ddb4 0%,#70aa7d 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #b4ddb4 0%,#70aa7d 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #b4ddb4 0%,#70aa7d 100%); /* IE10+ */
background: linear-gradient(to bottom, #b4ddb4 0%,#70aa7d 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b4ddb4', endColorstr='#70aa7d',GradientType=0 ); /* IE6-9 */
}
Use the :active psudeo class:
input
{
color:red;
}
input:active
{
color:blue;
}
Fiddle here
I'm using this gradient editor: http://www.colorzilla.com/gradient-editor/
But instead of displaying a smooth background like displayed, I get this: http://i.imgur.com/Ktk7fR7.png
I've tried setting background-repeat:repeat-y and x but it doesn't seem to help!
I am not sure if you need it to be an <img> or not, if not, you could make it a <div> and use the exact code which generated the gradient you saw on the mentioned tool.
<div style="-webkit-user-select: none; cursor: -webkit-zoom-in;background: background: #1e5799; /* Old browsers */background: -moz-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 63%, #7db9e8 100%); /* FF3.6+ */background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(50%,#2989d8), color-stop(63%,#207cca), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */background: -webkit-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */background: -o-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* Opera 11.10+ */background: -ms-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* IE10+ */background: linear-gradient(to bottom, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* W3C */filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 ); /* IE6-9 */; /* FF3.6+ */;" width="713" height="300"></div>
instead of:
<img style="-webkit-user-select: none; cursor: -webkit-zoom-in;" src="http://i.imgur.com/Ktk7fR7.png" width="713" height="300">
to be specific. I am not sure how to get it to work with an <img>.
Example of code placing the gradient background on the body-tag to have a full-page gradient background:
<html>
<head>
<meta name="viewport" content="width=device-width">
<title>pcfOTC7.png (1312×602)</title>
</head>
<body style="position:absolute; margin: 0px;background: #1e5799; /* Old browsers */ background: -moz-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 63%, #7db9e8 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(50%,#2989d8), color-stop(63%,#207cca), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* IE10+ */ background: linear-gradient(to bottom, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 ); /* IE6-9 */;">
</body>
</html>
I got a css class to separate the contents:
HTML:
<div class='seperator-gradient'></div>
css:
.seperator-gradient{
width: 100%;
height: 1px;
border-bottom:
background: #c4c4c4; /* Old browsers */
background: -moz-linear-gradient(left, #ffffff 0%, #e3e3e3 10%, #b8b8b8 50%, #e3e3e3 90%, #fcfcfc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#ffffff), color-stop(10%,#e3e3e3), color-stop(50%,#b8b8b8), color-stop(90%,#e3e3e3), color-stop(100%,#fcfcfc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #ffffff 0%,#e3e3e3 10%,#b8b8b8 50%,#e3e3e3 90%,#fcfcfc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #ffffff 0%,#e3e3e3 10%,#b8b8b8 50%,#e3e3e3 90%,#fcfcfc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #ffffff 0%,#e3e3e3 10%,#b8b8b8 50%,#e3e3e3 90%,#fcfcfc 100%); /* IE10+ */
background: linear-gradient(to right, #ffffff 0%,#e3e3e3 10%,#b8b8b8 50%,#e3e3e3 90%,#fcfcfc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fcfcfc',GradientType=1 ); /* IE6-9 */
}
this works fine, but now, I have a table, I'd like the bottom of each cells of this table has the same feature like the above. Is it possible to achieve this?
at the moment, I make the table's css to:
border-bottom: 1px solid;
but it doesn't have the same effect as the seperator-gradient class can achieve.
This is only supported in a few browsers at the moment:
-webkit-border-image: -webkit-gradient(linear, left top, right top, color-stop(0%,#ffffff), color-stop(10%,#e3e3e3), color-stop(50%,#b8b8b8), color-stop(90%,#e3e3e3), color-stop(100%,#fcfcfc)) 0 0 1 1 repeat repeat;
Here's the browsers it's supported in: http://caniuse.com/#search=border-image
apply the class .seperator-gradient
property to all td tags of that particular table
In your css put
table td {
width: 100%;
height: 1px;
border-bottom:
background: #c4c4c4; /* Old browsers */
background: -moz-linear-gradient(left, #ffffff 0%, #e3e3e3 10%, #b8b8b8 50%, #e3e3e3 90%, #fcfcfc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#ffffff), color-stop(10%,#e3e3e3), color-stop(50%,#b8b8b8), color-stop(90%,#e3e3e3), color-stop(100%,#fcfcfc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #ffffff 0%,#e3e3e3 10%,#b8b8b8 50%,#e3e3e3 90%,#fcfcfc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #ffffff 0%,#e3e3e3 10%,#b8b8b8 50%,#e3e3e3 90%,#fcfcfc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #ffffff 0%,#e3e3e3 10%,#b8b8b8 50%,#e3e3e3 90%,#fcfcfc 100%); /* IE10+ */
background: linear-gradient(to right, #ffffff 0%,#e3e3e3 10%,#b8b8b8 50%,#e3e3e3 90%,#fcfcfc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fcfcfc',GradientType=1 ); /* IE6-9 */
}
Here is some usefull gradient effects.
http://css-tricks.com/examples/GradientBorder/
I'm trying to add an arrow image to my link and have it positioned to the middle.
My link has a background gradient in place as well and im trying to apply a background-image on to of this applied to the right.
CSS
#nav a.linkchildflyout:link,
#nav a.linkchildflyout:active,
#nav a.linkchildflyout:visited
{
display:block;
padding:0px 5px;
text-decoration:none;
background: #b95d73; /* Old browsers */
background: -moz-linear-gradient(top, #b95d73 0%, #970e2e 0%, #9c1a38 0%, #910022 52%, #b95d73 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b95d73), color-stop(0%,#970e2e), color-stop(0%,#9c1a38), color-stop(52%,#910022), color-stop(100%,#b95d73)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #b95d73 0%,#970e2e 0%,#9c1a38 0%,#910022 52%,#b95d73 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #b95d73 0%,#970e2e 0%,#9c1a38 0%,#910022 52%,#b95d73 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #b95d73 0%,#970e2e 0%,#9c1a38 0%,#910022 52%,#b95d73 100%); /* IE10+ */
background: linear-gradient(top, #b95d73 0%,#970e2e 0%,#9c1a38 0%,#910022 52%,#b95d73 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b95d73', endColorstr='#b95d73',GradientType=0 ); /* IE6-9 */
color: white;
}
#nav a.linkchildflyout
{
background-image: url(Images/arrow.png);
background-position: right center;
background-repeat: no-repeat;
}
You can (and should) use the :before and :after pseudo-elements to achieve such effects.
Here's a Great article on the subject!
Yes there css3 multiple background property. You can write like this:
#nav a.linkchildflyout{
background:linear-gradient(top, #b95d73 0%, #970e2e 0%, #9c1a38 0%, #910022 52%, #b95d73 100%),url(Images/arrow.png) no-repeat right center;
}
Read this for more http://www.css3.info/preview/multiple-backgrounds/