Availability: |
| |||||||
Property/method value type: | String primitive | |||||||
JavaScript syntax: | - | myStyle.border | ||||||
CSS syntax: | border: aWidth aStyle aColor | |||||||
Argument list: | aWidth | A border width value | ||||||
aStyle | A border style selector | |||||||
aColor | A color value |
This property provides a way to set all four borders in one assignment. It takes three values. However, you must specify the border style value for it to have any effect. The three values to define are:
borderStyle
borderColor
borderWidth
Of course, you can specify them individually if you prefer, but this property may provide a cleaner display transition.
The three items should be space separated and defined as they would be for the specific properties that operate on them individually. Because the properties use distinctly different namespaces, the values can be defined in any order so long as the style value is always present.
You should include the width attribute. In fact unless you are specifying all three values, this shortcut isn't much of a saving over the discrete property setting mechanisms.
Borders and outlines are similar but not the same. An outline is like a border but it is drawn within the extent of the object. A border is drawn outside the object. The width of a border is measured outwards from the edge of element while the outline width is measured inwards.
Prev | Home | Next |
style.behavior | Up | style.borderBottom |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |