CSS3实现阴影和圆角效果(多浏览器兼容)

css3阴影:

[css]
.shadow {
-moz-box-shadow: 3px 3px 4px #000;
-webkit-box-shadow: 3px 3px 4px #000;
box-shadow: 3px 3px 4px #000;
/* For IE 8 */
-ms-filter: “progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color=’#000000′)”;
/* For IE 5.5 – 7 */
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color=’#000000′);
}
[/css]

css3圆角

[css]

/* Gecko browsers */
-moz-border-radius: 5px;
/* Webkit browsers */
-webkit-border-radius: 5px;
/* W3C syntax – likely to be standard so use for future proofing */
border-radius:10px;

-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-o-border-radius: 5px;
border-radius:10px;
[/css]

支持上、右、下、左

[css]
border-radius:5px 15px 20px 25px;
[/css]

支持拆分书写

[css]
/* Gecko browsers */
-moz-border-radius-topleft: 20px;
-moz-border-radius-topright: 0;
-moz-border-radius-bottomleft: 0;
-moz-border-radius-bottomright: 20px;

/* Webkit browsers */
-webkit-border-top-left-radius: 20px;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 20px;

/* W3C syntax */
border-top-left-radius: 20px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 20px;
[/css]

圆角浏览器支持性
Firefox(2、3+) √
Google Chrome(1.0.154+…) √
Google Chrome(2.0.156+…) √
Safari(3.2.1+ windows) √
Internet Explorer(IE7, IE8) ×
Opera 9.6 ×

您的赞助将会支持作者创作及本站运维

发表评论


TOP