【发布时间】:2020-05-31 12:26:17
【问题描述】:
我有以下 HTML:
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="10.5" cy="10.5" r="7.5"></circle>
<line x1="21" y1="21" x2="15.8" y2="15.8"></line>
</svg>
HTML 看起来很笨拙,如何将其属性转换为 CSS?
例如:
#search-svg {
width: 20;
height: 20;
viewBox: 0 0 24 24;
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round
}
我知道width、height和fill属性存在并且可以转换成CSS。
但是我不知道其他属性是如何工作的,也不知道它们的 CSS 等效项是什么,并且在 caniuse 上快速搜索不会找到以 stroke 开头的 CSS 属性的结果。
谢谢。
【问题讨论】:
标签: html css svg code-separation