html - 水平对齐,文本在图像顶部?

标签 html image text-align

嗨! 我在我想要的图像旁边有文字。如下所示。

https://image.ibb.co/bWWO0F/Capture.jpg

然而,我正在努力将文字放在图像的顶部,就像我在这里的惊人画作一样......

https://image.ibb.co/ksgZ7v/Capture1.jpg

我该怎么做?

这是我的 HTML...

<div>
    <img style="vertical-align:middle" width="350" class="img-circle" align="top" src="image.jpg">
    <p>Works.</p>
</div>

最佳答案

使用 flexbox .

.flexbox {
  display: flex;
  border: 1px solid;
  padding: 15px;
}

.img-circle {
  border-radius: 100%;
}
<div class="flexbox">
  <img style="vertical-align:middle" width="350" class="img-circle" align="top" src="http://placehold.it/350x350">
  <p>Works.</p>
</div>

关于html - 水平对齐,文本在图像顶部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44960230/

相关文章:

php - 数据未插入mysql数据库但代码运行没有错误

android - 我的计时器不工作

ios - UIImage 到另一个 UIImage

html - 文本对齐属性在按钮内不起作用

html - 在 UP 中居中包含更多 li 元素的 li 元素并将文本左右对齐

css - 如何将文本对齐到右对齐标题的左侧?

php - Yii,我正在尝试为我的 View 设置一个动态布局

html - 在标题中垂直居中 Logo 和导航链接

python - 从服务器流式传输大量屏幕截图

javascript - 内联onclick是如何评估的?