【发布时间】:2021-05-15 07:06:40
【问题描述】:
一个我无法弄清楚的超级简单的问题。我是新手。如何在卡片标题中插入图像?我已经尝试了 30 分钟,但在网上找不到任何东西。我知道这是一个菜鸟问题。饶了我吧。任何帮助将不胜感激。
这是我要插入的图片:
https://media1.giphy.com/media/l0HlSBFa5Z9onGbcc/giphy.gif
我似乎无法将其正确放置在 rect 标记或 svg 标记中。任何帮助都可以。或者指向正确的方向。
<div class="album py-5 bg-light">
<div class="container">
<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3">
<div class="col">
<div class="card shadow-sm">
<svg class="bd-placeholder-img card-img-top" width="100%" height="225" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Thumbnail" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#55595c" /><text x="50%" y="50%" fill="#eceeef" dy=".3em">Project 1</text></svg>
<div class="card-body">
<p class="card-text">Click "View" to see my posted Project 1. Project 1 is my personal Student Feedback Form. When the form is submitted it will display to you the data inputted as well as give the course and professor a score.</p>
<div class="d-flex justify-content-between align-items-center">
<div class="btn-group">
<button type="button" class="btn btn-sm btn-outline-secondary">View</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
感谢您抽出宝贵的时间。
【问题讨论】:
-
不使用 SVG,为什么不尝试使用 Image-tag。
<img src="/image.jpg" alt="Card Image">
标签: html css image bootstrap-4