CSS 属性

outline-color 属性设置元素周围轮廓的颜色。

属性值

  • <color>: 任何有效的颜色值。颜色可以是任何名称、十六进制、RGB、HSL。

  • invert: 轮廓对其绘制的区域执行颜色反转。请注意,浏览器不需要支持该值;如果不这样做,则该关键字被视为无效。

适用范围

所有 HTML 元素。

DOM 语法

object.style.outlineColor = "red"; 

CSS outline-color: <color> 

这里是示例 -

<html>
<head>
</head>
<body>
   <p style = "outline-width:thin; outline-style:solid;outline-color:red">
      outline-color is set to red outline.
   </p>
   <p style = "outline-width:thin; outline-style:dashed;outline-color:#009900">
      outline-color is set to HEX color as outline.
   </p>
   <p style = "outline-width:thin;outline-style:dotted;outline-color:rgb(13,33,232)">
      outline-color is set to RGB color as outline.
   </p>
   <p style = "outline-width:thin;outline-style:solid;outline-color:hsl(2, 100%, 50%)">
      outline-color is set to HSL color as outline.
   </p>
   <p style = "outline-width:thin;outline-style:solid;outline-color:invert">
      outline-color is set to invert as outline.
   </p>
</body>
</html>