Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 在图像下提供字幕_Html_Css - Fatal编程技术网

Html 在图像下提供字幕

Html 在图像下提供字幕,html,css,Html,Css,我需要在每张图片下添加标题。我试着用了标签,也用了标签,但我没能得到想要的结果 强文本 像这样吗?运行代码 .text{位置:相对;文本对齐:居中;} .images{显示:内联块;页边距顶部:10px;} 强文本 强文本 希望它能帮助你 HTML <div> <img src='image1.jpg' alt='image1' /> <span class="caption">Caption goes here</span>

我需要在每张图片下添加标题。我试着用了标签,也用了标签,但我没能得到想要的结果


强文本
像这样吗?运行代码

.text{位置:相对;文本对齐:居中;}
.images{显示:内联块;页边距顶部:10px;}

强文本
强文本
希望它能帮助你

HTML

<div>
    <img src='image1.jpg' alt='image1' />
    <span class="caption">Caption goes here</span>
</div>

<div>
    <img src='image1.jpg' alt='image1' />
    <span class="caption">Caption goes here</span>
</div>
.caption {
  display: block;
  font-weight: bold;
  margin-top: 10px;
}