此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。
text-emphasis-color
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2022年3月.
CSS 属性text-emphasis-color 设置强调色。这个值也可以使用简写属性text-emphasis 来设置。
In this article
尝试一下
text-emphasis-color: currentColor;text-emphasis-color: red;text-emphasis-color: rgba(90, 200, 160, 0.8);<section> <p> I'd far rather be <span>happy than right</span> any day. </p></section>p { font: 1.5em sans-serif;}#example-element { text-emphasis: filled;}语法
css
/* 初始值 */text-emphasis-color: currentcolor;/* <color> */text-emphasis-color: #555;text-emphasis-color: blue;text-emphasis-color: rgb(90 200 160 / 80%);text-emphasis-color: transparent;/* 全局值 */text-emphasis-color: inherit;text-emphasis-color: initial;text-emphasis-color: revert;text-emphasis-color: revert-layer;text-emphasis-color: unset;取值
<color>指定用作强调色的颜色。如果未定义,该值默认为
currentcolor。
形式定义
形式语法
text-emphasis-color =
<color>
示例
>设置自定义强调色和强调标记
CSS
css
em { text-emphasis-color: green; text-emphasis-style: "*";}HTML
html
<p>这是一个示例:</p><em>这里有强调标记!</em>结果
规范
| Specification |
|---|
| CSS Text Decoration Module Level 3> # text-emphasis-color-property> |