开发者

Experimental CSS and old fashioned browsers

Is it a good idea to use experimental CSS-properties like border-radius, text-shadow, box-shadow and gradient in a layout today? And what about values like rgba()?

When I look at web galleries, these CSS-properties are frequently used and according to articles like on 24ways.org it is not a problem to use t开发者_开发知识库hese properties.

What is your opinion?


I would say it's a decidedly bad idea to depend on those properties right now. You can use them, but they won't work in many browsers.

Off the top of my head: border-radius, text-shadow and box-shadow and rgba won't work in IE at all. Source for rgba, official IE compatibility table for all CSS properties

Since IE still holds a remarkable share in the browser market, it would be foolish to ignore it.

The nice thing about all those effects is that it is still possible to create a site that looks great with them, and still decent without them. The only exception to that may be rgba depending on the context you use it in.


The CSS standard says: "When a user agent cannot parse the selector (i.e., it is not valid CSS 2.1), it must ignore the selector and the following declaration block (if any) as well.", see http://www.w3.org/TR/CSS21/syndata.html

This means you may use the rgba() and older browsers should ignore that. However, you may provide a fallback value for them (see http://css-tricks.com/rgba-browser-support/ ):

background:#cfdfaf; /*works on old browsers*/
background:rgba(200, 54, 54, 0.5); 
     /*overrides the previous declaration for new browsers*/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜