插入svg的方法

June 19, 2021

需求:在超链接后面插入一个名为link.svg的小图标,Demo:anchor

方法一:作为图片引入svg

<a>anchor<img src="/img/link.svg"></a>

方法二:直接在HTML写入

<a>anchor<svg>...</svg></a>

方法三:使用CSS伪类引入图片

a:after {
  content: url("/img/link.svg");
}

方法四:直接在CSS用伪类

a:after {
  content: url("data:image/svg+xml;utf8,<svg>...</svg>");
}

Category

CSS

You may also like

水平垂直居中 解决锚定位被fixed遮挡

No comments yet, leave a comment

Sending failed, please try again.
Sending succeeded! It will be displayed in one minute, please refresh.
Newer Older