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, Opera or Safari/Webkit.
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:
Mozilla/Firefox users should see a nice grey fading border on this box…
The CSS code for this is:
border: 8px solid #000;
<del>moz</del>border-bottom-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc;
<del>moz</del>border-top-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc;
<del>moz</del>border-left-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc;
<del>moz</del>border-right-colors: #555 #666 #777 #888 #999 #aaa #bbb #ccc;
padding: 5px 5px 5px 15px;
CSS3: border-image
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:
o border-top-image
o border-right-image
o border-bottom-image
o border-left-image
* border-corner-image:
o border-top-left-image
o border-top-right-image
o border-bottom-left-image
o border-bottom-right-image
An easy way to use this is like this:
<del>webkit</del>border-image: url(”border.png”) 27 27 27 27 round round;
Or
<del>webkit</del>border-image: url(”border.png”) 27 27 27 27 stretch stretch;
Rounded borders, create them with CSS!
W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and WebKit have implemented this function, which allows you to create round corners on box-items. This is an example:
Mozilla/Firefox and WebKit users should see a nicely rounded box, with a nicely rounded border.
As of r14650 WebKit can draw these rounded borders too. The code for this example above is actually quite simple:
<div style=” background-color: #ccc;
<del>moz</del>border-radius: 5px;
<del>webkit</del>border-radius: 5px;
border: 1px solid #000;
padding: 10px;” >
</div>
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. <del>moz</del>border-radius-topright as opposed to <del>webkit</del>border-top-right-radius:
These are handled by / should be handled by:
<br />
* <del>moz</del>border-radius-topleft / <del>webkit</del>border-top-left-radius
* <del>moz</del>border-radius-topright / <del>webkit</del>border-top-right-radius
* <del>moz</del>border-radius-bottomleft / <del>webkit</del>border-bottom-left-radius
* <del>moz</del>border-radius-bottomright / <del>webkit</del>border-bottom-right-radius
Box-shadow, one of CSS3’s best new features
The CSS3 backgrounds and borders module has a nice new feature called box-shadow, which has just been implemented for the first time in WebKit. The specification speaks of multiple shadows, but the author already has it’s “doubts” on that, and it isn’t implemented in WebKit.
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 not so lucky as to have access to WebKit, here’s a screenshot.
WebKit nightly users should see a nice grey fading shadow





