Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Webkit gradient on HTML element 1

Status
Not open for further replies.

Wolfie7873

Technical User
Jan 15, 2004
94
US
I have my html (parent) element styled thusly:

Code:
html {
	background-color: #888; /* for non-css3 browsers */
	-ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=1, startColorstr=#888888, endColorstr=#dddddd)"; /* for IE 8+? */
	filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1, endColorstr='#dddddd', startColorstr='#888888'); /* for IE 5.5 - 7 */
	background-image: -webkit-gradient(linear, top left, top right, from(#888), to(#ddd)); /* for webkit browsers */
	background-image: -moz-linear-gradient(left,  #888,  #ddd); /* for firefox 3.6+ */
	background-image: -o-linear-gradient(#888, #ddd); /* for Opera 11.10+ */
	background-repeat:no-repeat;
	height: 100%;
}

The background should be a gradient from dark gray to light gray moving left to right. Works in FF and IE, but not in the webkit browsers (Safari, Chrome). Any guesses why? The same styles applied to divs later the in page work just fine.
 
Hi

Which Chrome and Safari versions ?
Code:
background-image: -webkit-gradient(linear, top left, top right, from(#888), to(#ddd)); [gray]/* [s]for webkit browsers[/s] Chrome, Safari 4+*/[/gray]
background-image: -webkit-linear-gradient(left,  #888,  #ddd); [gray]/* Chrome 10+, Safari 5.1+ */[/gray]


Feherke.
 
Safari 5, Chrome 10.

I now have:

Code:
html {
	background-color: #888; /* for non-css3 browsers */
	-ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=1, startColorstr=#888888, endColorstr=#dddddd)"; /* for IE 8+? */
	filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1, endColorstr='#dddddd', startColorstr='#888888'); /* for IE 5.5 - 7 */
	background-image: -webkit-gradient(linear, top left, top right, from(#888), to(#ddd)); /* for Chrome, Safari 4+ */
	background-image: -webkit-linear-gradient(left, #888, #ddd); /* for Chrome 10+, Safari 5.1+ */
	background-image: -moz-linear-gradient(left,  #888,  #ddd); /* for firefox 3.6+ */
	background-image: -o-linear-gradient(#888, #ddd); /* for Opera 11.10+ */
	background-repeat:no-repeat;
	height: 100%;
}

Works now in Chrome, but not in Safari.
 
Hi

Oops, I quite forgot this thread.

In case someone is/will ever be interested in this, the problem was that coordinate order : must be horizontal vertical, in this case [tt]left[/tt] [tt]top[/tt] and [tt]right[/tt] [tt]top[/tt] respectively :
Code:
background-image: -webkit-gradient(linear, [highlight]left top[/highlight], [highlight]right top[/highlight], from(#888), to(#ddd)); [gray]/* for webkit browsers Chrome, Safari 4+ */[/gray]

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top