WeLoveCSS Logo
Home Profile Members Search Rules Help New Posts



WeLoveCSS > WEB DESIGN > Browser Compatibility > Conditional Webkit

Reply
  Thread Tools Display Modes
Old 18th May 12, 04:47 PM   #1
ChocolateLover
WLC Member
 
Join Date: Sep 2008
Posts: 13
Default Conditional Webkit

I'd like to include some CSS that only webkit supports.

What's the best way of adding the CSS conditionally? Something like

Code:
<!--[if webkit]>
or would I have to include each supported browser, and if so were could I find the codes for the browser, for example Internet Explorer 6 is IE 6.

Any help appreciated, thanks.
ChocolateLover is offline   Reply With Quote
Old 18th May 12, 05:25 PM   #2
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: Conditional Webkit

Only Internet Explorer has conditional comments.

Just use the -webkit- vendor prefix to the CSS properties.
chrishirst is offline   Reply With Quote
Old 18th May 12, 05:37 PM   #3
ChocolateLover
WLC Member
 
Join Date: Sep 2008
Posts: 13
Default Re: Conditional Webkit

Thanks but I'm using
Code:
-webkit-background-clip: text;
to create gradient text and where it's not supported I get the gradient background, so I do need to apply it only to browsers that support webkit.
ChocolateLover is offline   Reply With Quote
Old 18th May 12, 05:47 PM   #4
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: Conditional Webkit

????

Only browsers built with the webkit rendering engine support the -webkit- prefix.

That's Safari and Chrome.
chrishirst is offline   Reply With Quote
Old 18th May 12, 06:54 PM   #5
ChocolateLover
WLC Member
 
Join Date: Sep 2008
Posts: 13
Default Re: Conditional Webkit

Sorry, I should have posted the CSS to be more clear.

To give the text a gradient I'm giving the background a gradient and then using the text as a mask. If the browser doesn't support clipping to the text, I'll just use a single colour. It's the clipping to text that's only supported by webkit, so other browsers I guess show the background but don't clip to the text. It's not essential, just a nice to have and a learning experience.

Code:
background-color: #c86476;
background-image: -webkit-gradient(linear, left top, left bottom, from(#c86476), to(#b44b57));
background-image: -webkit-linear-gradient(top, #c86476, #b44b57);
background-image: -moz-linear-gradient(top, #c86476, #b44b57);
background-image: -o-linear-gradient(top, #c86476, #b44b57);
background-image: -ms-linear-gradient(top, #c86476, #b44b57);
background-image: linear-gradient(top, #c86476, #b44b57);
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#c86476', EndColorStr='#b44b57');
background-clip:

  -webkit-background-clip: text;
Thanks for your help.
ChocolateLover is offline   Reply With Quote
Reply


Thread Tools
Display Modes
Linear Mode Linear Mode

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:29 AM.



Home | Advertise | Contact Us | Top
Home | Advertise | Contact Us | Top

Copyright© 2006 WeLoveCSS.com. All Rights Reserved.
Powered by vBulletin Version 3.8.4 Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.