画像を反映させたいのですが、反映できません。
解決策をご教示いただけると助かります。
画像はassets/imagesに入れています。
【html.erb】
<div class="corde_visual">
<div class="corde_visual_image"></div>
</div>
【application.css】
.corde_visual {
width: 800px;
height: 300px;
background-color: green;
}
.corde_visual_image {
background-image: url("<%= asset-path("image_item.jpg") %>");
height: 300px;
background-size:cover;
background-position: center;
}
ブラウザには
html
css
.corde_visual {
width: 800px;
height: 300px;
background-color: green;
}
.corde_visual_image {
** background-image: url(<%= asset-path("image_item.jpg) %>");**
※↑のコードの先頭に黄色い!マークがついているので原因はこれかと思います。
background-size: cover;
background-position: center;
}
となっています。
解決策をご教示いただけると助かります。
宜しくお願い致します。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/26 09:24