html - 在图像下添加文本(左、中、右)

标签 html css

我有一个问题。我想制作几张图片(左、中、右)并在其下方添加文字...这就是我想要做的

[image]     [image]     [image]
[text]      [text]      [text]

这是我当前的代码:

<img src="">
<p>Some Text</p>
<img src="" style="margin-left:150px;">
<p>Some Text</p>
<img src="" style="margin-left:300px;">
<p>Some text</p>

最佳答案

为此,您可以使用 HTML 标记 figurefigcaption,然后将数字向左浮动以获得您想要的效果。

HTML

<figure>
    <img src="deadlink.jpg" alt="noimg" />
    <figcaption>Caption goes here</figcaption>
</figure>

<figure>
    <img src="deadlink.jpg" alt="noimg" />
    <figcaption>Caption goes here</figcaption>
</figure>

<figure>
    <img src="deadlink.jpg" alt="noimg" />
    <figcaption>Caption goes here</figcaption>
</figure>

CSS

figure {
  position: relative;
  float: left;
}

工作示例:

http://codepen.io/anon/pen/BLGaQp

关于html - 在图像下添加文本(左、中、右),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40127568/

相关文章:

javascript - Php Javascript 从 while 循环中显示的数据库中删除文件

html - 如何添加一个宽度为 100% 且位置为 :fixed 的按钮

jquery - 汉堡菜单应显示在背景内容上方

css - 如何在编辑器中连续输入数据以呈现pdf时对齐pdf报告的内容

jquery - 在移动 View 而不是桌面 View 中制作响应式 slider

javascript - 通过 JS 更改 CSS 图片

javascript - 当事件处理程序从另一个事件处理程序被 react 和减少时附加到组件上

html - 显示 : inline-block, 跨度未正确对齐

jquery - 无论我做什么,CSS 宽度都不会改变

html - 元素文本内容在水平排列的混合内联元素中不可见