CSS3新特性预览:border
CSS3新特性介绍:border属性
Many exciting new functions and features are being thought up for CSS3. We will try and showcase some of them on this page, when they get implemented in either Firefox, Konqueror, Opera or Safari/Webkit.
Borders
- border-color
- border-image
- border-radius
- box-shadow
1. How to create colored borders with CSS3
W3C has offered some new options for borders in CSS3, of which, next to rounded borders, border-color is also very interesting. Mozila/Firefox has implemented this function, which allows you to create cool colored borders. This is an example:
The CSS code for this is:
And ofcourse, you can also do cool color stuff:
2. Border-image: using images for your border
Another exciting new border feature of CSS3 is the property border-image. With this feature you can define an image to be used instead of the normal border of an element. This feature is actually split up into a couple of properties: border-image and border-corner-image. These two values are shorthands for:
border-image currently works in Safari and Firefox 3.1 (Alpha). The syntax to use it is:
Which results in:
Or:
Which then results in:
3. Border-radius: CSS3圆角边框.
W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:
The code for this example above is actually quite simple:
These different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:
These are handled by / should be handled by:
4. Box-shadow,CSS3新特性:区块投影效果
The CSS3 backgrounds and borders module has a nice new feature called box-shadow, which is implemented in Safari 3+ and Firefox 3.1 (Alpha). The specification speaks of multiple shadows, but the author already “has his doubts” on that, and it isn’t implemented in Safari 3.
The property takes 3 lengths and a color as it’s attributes, the lengths are:
- the horizontal offset of the shadow, positive means the shadow will be on the right of the box, a negative offset will put the shadow on the left of the box;
- the vertical offset, a negative one means the box-shadow will be on top of the box, a positive one means the shadow will be below the box;
- the blur radius, if set to 0 the shadow will be sharp, the higher the number, the more blurred it will be.
The shadow should be following curved corners created with border-radius. For those of you without a supporting browser, here’s a screenshot.
The CSS code for this is:
The CSS code for this is:
- Reads(1678)
- Comments(0)





WebHosting Coupons 虚拟主机优惠码大全(2
CSS布局:40个教程,技巧,演示