【发布时间】:2018-06-07 16:59:39
【问题描述】:
您能告诉我如何使用SCSS 动态添加blockquote 图像吗?
注意:
我在这条路径上有svg 图像:assets/icon/left-quote.svg
这是我需要的。
在这里你可以看到它来自后端(即blockquote标签)。
【问题讨论】:
您能告诉我如何使用SCSS 动态添加blockquote 图像吗?
注意:
我在这条路径上有svg 图像:assets/icon/left-quote.svg
这是我需要的。
在这里你可以看到它来自后端(即blockquote标签)。
【问题讨论】:
您可以按如下方式使用::before 伪选择器:
blockquote {
text-align: center;
font-weight: bold;
font-style: italic;
color: darkblue;
}
blockquote::before {
display: block;
width: 1.5em;
height: 1.5em;
margin: 1em auto;
content: url("https://upload.wikimedia.org/wikipedia/commons/2/25/Quote_left_font_awesome.svg");
}
<blockquote>
Parties prenantes de cette organisation (marchande ou non-marchande) par rapport aux attentes et besoins
</blockquote>
让它更像 SCSS:
blockquote {
text-align: center;
font-weight: bold;
font-style: italic;
color: darkblue;
&::before {
display: block;
width: 1.5em;
height: 1.5em;
margin: 1em auto;
content: url("https://upload.wikimedia.org/wikipedia/commons/2/25/Quote_left_font_awesome.svg");
}
}
【讨论】:
content: url('./assets/icon/left-quote.svg');
'./assets/icon/left-quote.svg'一样吗?
www文件夹中。我通常对所有images、SVGs 等www\assets\icon\left-quote.svg 使用上述类型的URL。有什么线索吗?