WWW FAQs: Exactly what does the border-color CSS attribute do?


2004-05-04: To quote the CSS2 specification:
"if there is only one value, it applies to all sides. If there are two values, the top and bottom borders are set to the first value and the right and left are set to the second. If there are three values, the top is set to the first value, the left and right are set to the second, and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and left, respectively."
For example, the following statement in a .css cascading style sheet file:

H1 { border-color: red green blue orange }

Indicates that text in <H1> heading elements should be surrounded by a border which is red on the top, green on the right side, blue on the bottom, and orange on the left. (Not a recommended design choice... but to each her own!)

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!