I'm working in WP7 where my application is based in HTML5 and I'm exporting the app through PhoneGap framework.
I want to know if is possible and how to generate a CSS3 gradient for this project (and in the process, I want to share you what I've discovered).
At the moment this is my CSS3 code:
body {
background: brown;
background-image: url(blue_to_white.jpg);
background: linear-gradient(blue, red); /*future CSS3 browsers*/
background: -webkit-linear-gradient(blue, orange); /*new webkit*/
background-image: -ms-linear-gradient(bottom, blue 50%, green 50%); /* IE10 */
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='blue', endColorstr='purple'); /* IE6 & IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='blue', endColorstr='yellow')"; /* IE8 */
-pie-background: linear-gradient(blue, silver); /*PIE*/
behavior: url(PIE.htc);
}
As you can see, my code is using different techniques for the background:
A brown like color base
An image like gradient of blue to white
A normal CSS3 gradient of blue to red
A CSS3 gradient for webkit browsers of blue to orange
A CSS3 gradient for Microsoft browsers of blue to green
A DXImageTransform for IE6 & IE7 of blue to purple
A DXImageTransform for IE8 of blue to yellow
A pie-background using CSS3PIE of blue to silver
And this is my results:
As you may know, the browser for WinPhone 7.5 is IE9 Mobile, and the browser for WinPhone 7.0 is a mix between IE7 & IE8. Here into slide 16, 17 and 18 explains which CCS3 properties are implemented in IE9, IE10 and "IE9 Mobile": http://goo.gl/1Wz3s
So, Any idea of how to generate a CSS3 gradient in Windows Phone?
or I have no choice and I must implement an image to create this gradient?
Just wanted to show the correct syntax for CSS3 Gradients in IE10+
background: -ms-linear-gradient(
bottom,
#432100 30%,
#00AAAA 70%);
In the google code link posted by JC Del Valle, he is using a backgroung-image definition, which is not correct.
[stack overflow prevented me from inserting image]
In the screen capure at twitter link (#palermo4), I tested your styles as-is. It appears to be working. Something else is in conflict with your CSS3 stuff.
Related
Recently I have been coding a clicker game, and have found the need to use a meter to display progress. I wanted the meter to have a gradient that goes from light pink to cyan, and it works perfectly on chrome. However, when I used my home computer and booted up firefox; the gradient was no longer displayed; and the meter was a dull shade of green.
.pastrymeter::-webkit-meter-optimum-value {
background : linear-gradient(90deg, lightpink, cyan);
}
This is the styling for the meter; and nothing that I have changed fixes it. I tried adding the moz prefix to the background tag; which did nothing. I also tried changing background to background-image to see if it was an element thing; but that also did nothing.
What can I do to fix this?
Looks like you are targeting a non-standard feauture -webkit-meter-optimum-value, that isn't supported in Firefox.
https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-meter-optimum-value
Try this, it is cross-browser compatible.
background: -moz-linear-gradient(90deg, lightpink, cyan);
background: -webkit-gradient(linear, left top, left bottom, from(#cfddac), to(#fff));
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cfddac', endColorstr='#ffffff');
background: -o-linear-gradient(rgb(207,221,172),rgb(255,255,255));
Change the values as you may require
Can you try this second method ?
<div style="background-image: -webkit-linear-gradient(bottom, #FE1C4A 22%, #AB244A 61%);
background-image: -moz-linear-gradient(bottom, #FE1C4A 22%, #AB244A 61%);
width: 200px; height: 100px; text-align: center;">
</div>
I'm using a CSS3 gradient like so:
background-image: linear-gradient(to bottom, transparent, #03143f);
The issue I'm having is that safari is adding a black tinge to the gradient where as Chrome is fading nicely.
Has anyone experienced this issue before?
JSFIDDLE
Safari
Chrome
I am trying to make the background a linear gradient. I have tried
nav {
background: -webkit-linear-gradient(black, gray, black); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(black, gray, black); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(black, gray, black); /* For Firefox 3.6 to 15 */
background: linear-gradient(black, gray, black); /* Standard syntax */
}
but it looks very choppy... Does anyone know any fixes to that off the top of their head? No need to go out of the way to look it up, though!
With the help of KyleT, I was able to use colorzilla.com in order to get code for a premade gradient, which is the website I recommend for anyone with the same question! Also, I used jsfiddle.com to test the gradient, and now I know about the basics of stackoverflow.com!
I want to combine background image and gradient. It should work in IE. my image is 3px width and 3px height. I am planning to give repeat for the background. How can we done it for Internet Explorer ???
Thanks in Advance
background: #6cab26;
background-image: url(IMAGE_URL); /* fallback */
background-image: url(IMAGE_URL), -webkit-gradient(linear, left top, left bottom, from(#444444), to(#999999)); /* Saf4+, Chrome */
background-image: url(IMAGE_URL), -webkit-linear-gradient(top, #444444, #999999); /* Chrome 10+, Saf5.1+ */
background-image: url(IMAGE_URL), -moz-linear-gradient(top, #444444, #999999); /* FF3.6+ */
background-image: url(IMAGE_URL), -ms-linear-gradient(top, #444444, #999999); /* IE10 */
background-image: url(IMAGE_URL), -o-linear-gradient(top, #444444, #999999); /* Opera 11.10+ */
background-image: url(IMAGE_URL), linear-gradient(top, #444444, #999999); /* W3C */
First 2 lines are the fallback for any browser that doesn't do gradients. See notes for stacking images only IE < 9 below.
Line 1 sets a flat background color.
Line 2 sets the background image fallback.
The rest set a background image and gradient for specific browsers.
Line 3 is for old webkit browsers.
Line 4 is for newer webkit browsers.
Line 5 is for Firefox 3.6 and up.
Line 6 is for Internet Explorer 10.
Line 7 is for Opera 11.10 and up.
Line 8 is what one day all the browsers will hopefully use.
See http://www.w3.org/TR/css3-background/#layering for more information about it.
Also see http://css3please.com for cross-browser css3 templating. Currently it doesn't allow you to do multiple backgrounds with gradients, but it gives you the browser prefixes and is kept up to date.
Stacking images ONLY (no gradients in the declaration) For IE < 9
IE9 and up can stack images this same way. You could use this to create a gradient image for ie9, though personally, I wouldn't. However to be noted when using only images, ie < 9 will ignore the fallback statement and not show any image. This does not happen when a gradient is included. To use a single fallback image in this case I suggest using Paul Irish's wonderful Conditional HTML element along with your fallback code:
.lte9 #target{ background-image: url(IMAGE_URL); }
If you need to target IE versions IE9 or earlier, they do not support CSS gradients.
There are work-arounds using filter and other hacks, but you will struggle to get those working if you want a background image as well.
My advice, therefore, is to use the CSS3Pie polyfill script. This library adds gradient support to older IE versions. It should be able to do what you want.
You'll end up with code like this in your CSS:
#myElement {
background: url(bg-image.png) #CCC; /*non-CSS3 browsers will use this*/
background: url(bg-image.png), -webkit-gradient(linear, 0 0, 0 100%, from(#CCC) to(#EEE)); /*old webkit*/
background: url(bg-image.png), -webkit-linear-gradient(#CCC, #EEE); /*new webkit*/
background: url(bg-image.png), -moz-linear-gradient(#CCC, #EEE); /*gecko*/
background: url(bg-image.png), -o-linear-gradient(#CCC, #EEE); /*opera 11.10+*/
background: url(bg-image.png), linear-gradient(#CCC, #EEE); /*CSS3-compilant browsers*/
-pie-background: url(bg-image.png), linear-gradient(#CCC, #EEE); /*PIE*/
behavior: url(PIE.htc);
}
Please see the CSS3Pie documentation for further info.
I want a vertical gradient without using an image. So, I've got this bit of CSS working on Firefox and Chrome, but it isn't working in IE9.
background: #fff;
background: -moz-linear-gradient(top, #46a5e5, #ffffff);
background: -webkit-gradient(linear, left top, left bottom, from(#46A5E5), to(#ffffff));
filter: progid:DXImageTransform.Microsoft.gradient(StartColorstr='#46A5E5', EndColorstr='#ffffff', GradientType=0);
Any advice?
looks like you're missing the up to date prefixed version of the IE filter for IE8 & 9.. though the older still works in IE8
try:
filter: progid:DXImageTransform.Microsoft.gradient(StartColorstr='#46A5E5', EndColorstr='#ffffff', GradientType=0); /* IE6/7/8 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#46a5e5', endColorstr='#ffffff')"; /* IE8/9 */
zoom: 1;
the new version must not be broke (it must stay on one line between the quotes)..
This article from Smashing Magazine may be helpful to you when designing for IE with CSS3.
One thing I have learned over the years is it is ok that your website doesn't look exactly the same in each browser, in fact it can be a benefit because I have had situations where the intended design looked fairly different in IE (but still still professional) and some users who preferred that UI would visit with IE instead of the beloved FireFox or Chrome.
Also with IE9, a lot of compatibility to CSS3 and HTML5 has been added so making your site or web app look consistent over all browsers is getting easier!
Just my 2 cents... I hope it helps.
Try this... I think height: 1% will solve this problem
background: #fff;
background: -moz-linear-gradient(top, #46a5e5, #ffffff);
background: -webkit-gradient(linear, left top, left bottom, from(#46A5E5), to(#ffffff));
filter: progid:DXImageTransform.Microsoft.gradient(StartColorstr='#46A5E5', EndColorstr='#ffffff', GradientType=0);
height: 1%;