html - 我应该如何将此文本放置在我的图像上?
问题描述
这就是我想要重建的。
到目前为止,这就是我对 HTML 的了解:
.carousel-cell {
position: relative;
}
.board-text {
position: absolute;
top: 50%;
}
<div class="carousel-cell">
<img src="img/board1.png" alt="">
<div class="board-text">
<h4>Funboards</h4>
<h2>Chilli Rare Bird</h2>
<h3>$890</h3>
<p>Buy</p>
</div>
</div>
解决方案
无法在 an 上放置文本,<img>
但您可以创建一个框,然后将图像作为background-image
. 然后你可以在框中写下你想要的文字。HTML 示例:<div id="imageBox">Your text</div>
CSS:#imageBox{background-image: url(img/board1.jpg)}
希望这会有所帮助;)
推荐阅读
- ios - 如何在 jenkins 中获取 XCTAttachments
- angular - 使用 Angular 和 firebase 数据库查找最近的位置
- asp.net - 控制器未从 MVC 上的视图(实现搜索功能)接收值
- dialogflow-es - Dialogflow SDK 或 Dialogflow REST API,哪个响应时间更快?
- r - 通过闭包内调用的外部函数访问封闭变量
- angular6 - 我使用 angular cli 工具在 angular 6 中创建项目,但它给出了错误 import * as fs from 'fs';
- mongodb - 精度会影响 MongoDB 地理空间查询的性能吗?
- aws-lambda - 具有五个以上安全组的更新功能配置
- ios - 我可以使用谷歌地图中的位置来旋转汽车吗?
- c++ - 获取基类的更简单方法