【发布时间】:2019-07-25 16:50:29
【问题描述】:
我在 CSS 中使用了内联 SVG,以便可以看到图像。但是,它不起作用,因为图像隐藏在整个 div 后面,即使我添加了 z-index,也看不到图像。另外,图片放在div的底部,需要放在顶部。
下面我放置了我的 HTML 和 CSS 代码,以便您更容易看到我在做什么。
.curve {
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-150 0 1000 270' style='transform: translateY(-5px)'><path d='M-314,267 C105,364 400,100 812,279' fill='none' stroke='#53DD6C' stroke-width='120' stroke-linecap='round' /></svg>");
background-repeat: no-repeat;
}
<div class="curve">
<div class="beforeFooter">
<div id="blankGTitle">
<h2>Impacting lives.</h2>
</div>
<div id="blankGText">
<h3>Create your event and make a difference.</h3>
</div>
<div id="buttono4">
<nuxt-link to="/create-event">
<buttons-vue text="create my event" type="buttonWhiteBackground buttonForInsetShadow buttonForInsetShadow:hover buttonForInsetShadow:active" />
</nuxt-link>
</div>
<div id="blankGText2">
<nuxt-link to="/organiser" id="blankGText2" class="wText">
<p class="underline">Tell me more</p>
</nuxt-link>
</div>
</div>
</div>
【问题讨论】:
-
您的背景图片 URL 无效,因为它包含未转义的 # 字符。
-
@RobertLongson 我已经更改了
stroke,但它仍然是隐藏的。 -
随时编辑问题以进行更新。
标签: html css svg vue.js background-image