What could be simpler and faster than using CSS to set up your website? Using CSS shorthand to set up your website. While not all browsers support all of CSS shorthand's features, enough of them are supported to allow you to write tighter code, and create a website that loads more quickly.
Border-width refers to the width of the border surrounding the selected element, while "border-style" specifies the style applied to that border. Possible values for this property include: "double," "groove," "inset," "ridge," "solid," "dashed," "dotted," and "none." Finally, the "border-color" property sets the color for the border of the element.
In order to understand these properties, two examples are listed below:
p {
border: 1px solid blue;
}
p {
border: dotted blue;
}
The first case will display a solid blue line of 1px for each border of a <p> element. The second example will show a dotted blue line for all the borders of the <p> element.
Still with me? Excellent. Let’s focus on another useful CSS shorthand property: individual borders.
Border-top, border-right, border-bottom and border-left shorthand property
These properties work identically to those defined for "border." However, the "border" property itself is not capable of discerning between the four sides of an element. These are specifically aimed to let you set a style to a specific border.
Take a look at the following examples:
p {
border-top: 1px solid red;
}
p {
border-right: solid blue;
}
p {
border-bottom: 1px dotted red;
}
p {
border-left: 2px solid #ffc;
}
The first case will display a solid red line of 1px for the "border-top" of the <p> element.
The second case will show a solid blue line for the "border-right" of the element.
The third and fourth examples will display a <p> element with a red dotted line of 1px for the "border-bottom," and a 2px yellow solid line for the "border-left" of the paragraph, respectively.
For the next section, we’ll see another handy shorthand property: list-style.