The outline-color
property is used to set the color of the outline.
The color can be set by:
The following example shows some different outlines with different colors. Also notice that these elements also have a thin black border inside the outline:
A solid red outline.
A dotted blue outline.
An outset grey outline.
p.ex1 {
border: 2px solid black;
outline-style: solid;
outline-color: red;
}
p.ex2 {
border: 2px solid black;
outline-style: dotted;
outline-color: blue;
}
p.ex3 {
border: 2px solid black;
outline-style: outset;
outline-color: grey;
}
Try it Yourself »
The outline color can also be specified using a hexadecimal value (HEX):
Or by using RGB values:
You can also use HSL values:
p.ex1 {
outline-style: solid;
outline-color: hsl(0, 100%, 50%); /* red */
}
Try it Yourself »
You can learn more about HEX, RGB and HSL values in our CSS Colors chapters.
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!