HTML and CSS Reference
In-Depth Information
table {
height: 50%;
width: 50%;
}
In another example, the size of a <div> element can be set to a specific value as in this
case:
div {
width: 200px;
height: 100px;
}
Bordering
CSS provides very granular control over the styles of the borders of any HTML element. The
name of the root CSS property to do this is the border property. With the use of the border
property, you can control the style, spacing, color, and width of the border.
The first thing that you need to set on the border is the style. This will essentially bring
the border into existence. There are a variety of border styles that exists. These include, solid
border, dashed border, dotted line border, grooved line border, and so on. The border is set
by specifying the border-style property:
p {
border-style: solid;
}
The color of the border can be changed by specifying the border-color property. This is
demonstrated with the following code:
p {
border-style: solid;
border-color: black;
}
All the <p> elements will now be displayed with a solid black border. This is demonstrated
in Figure 4-10.
FIGURE 4-10 A <p> element with border properties set
NOTE SETTING BORDER-STYLE
Note that the border needs to exist before it can have any visible changes done to it. This is
why in the above example, the border-style is set first.
 
Search WWH ::




Custom Search