HTML and CSS Reference
In-Depth Information
The next section looks at some common properties where these values
are used.
Borders and backgrounds
Two of the most common things to style are borders and backgrounds.
Each is controlled by several different CSS properties, and each has a
shorthand notation that lets you set all the properties in a single line.
This section looks at both of them, starting with borders.
A border has a width, a type, and a color. All three can be set sepa-
rately using the properties border-width (a length), border-style (a spe-
cial property for borders), and border-color (a color, unsurprisingly):
.one {
border-width: 5px;
border-style: solid;
border-color: #999;
.two {
border-width: 0.75em;
border-style: dashed;
border-color: #000;
The CSS above assumes that some elements
with appropriate classes are defined:
<div class="one"></div>
<div class="two"></div>
<div class="three"></div>
<div class="four"></div>
The shorthand notation uses the border prop-
erty. All that's required is for the same three
values to be listed with a space between:
.three {
border: 5pt dotted #333;
.four {
border: 0.25cm double #666;
Search WWH ::

Custom Search