An outline is a delineation encircling elements, positioned EXTERNALLY to their borders, aiming to enhance the element’s prominence.
The CSS specification includes the following outline attributes:
Please note: Outlines and borders are distinct. Unlike borders, outlines are drawn beyond the element’s border and may overlap other content. Additionally, outlines do not contribute to the element’s dimensions; thus, the total width and height of the element remain unaffected by the outline’s width. |
The outline-style property determines the style of the outline and accepts the following values:
Below is an example illustrating the various outline-style values:
Example
Illustration showcasing the diverse outline styles:
p.dotted {outline-style: dotted;} p.dashed {outline-style: dashed;} p.solid {outline-style: solid;} p.double {outline-style: double;} p.groove {outline-style: groove;} p.ridge {outline-style: ridge;} p.inset {outline-style: inset;} p.outset {outline-style: outset;} |
Result:
Please be aware that none of the other outline properties (which will be further elaborated on in subsequent chapters) will exert any influence unless the outline-style property is defined. |