html - 将图像与基线对齐

标签 html css

我需要构建如下布局

+-------+-----------------------------+-------+
|       |                             |       |
|       |                             |       |
|   A   |             B               |   C   |
|       |                             |       |
|       |                             |       |
|       |                             |       |
+-------+-----------------------------+-------+

在区域 A 中,我想放置一张与右上角对齐的图像。 在 B 区,我想放置一个居中的图像(垂直和水平) 在 C 区,我想放一张左下角对齐的图片

我有以下标记。

<div style="float: left;">
    <img src="/images/sx.jpg" alt="sx" height="100" width="90" />
</div>
<div class="slideshow" style="float: left;">
    [...]
</div>
<div style="float: right;">
    <img src="/images/dx.jpg" alt="dx" height="100" width="90" />
</div>

我尝试使用 CSS vertical-align 但它不起作用。我怎样才能得到我想要的? 感谢您的帮助

最佳答案

    <div style="float: left;">
    <img src="/images/sx.jpg" alt="sx" height="100" width="90" />
</div>
<div class="slideshow" style="padding:25% 50%; ">
    [...]
</div>
<div style="float: right; margin-top: -51.5%;">
    <img src="/images/dx.jpg" alt="dx" height="100" width="90" />
</div>

而且,请不要问为什么 51.5% - 它工作得很好(在 Chrome 中检查过),为什么 - 我自己也不知道)

关于html - 将图像与基线对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15507587/

相关文章:

javascript - 第二个菜单在导航时不添加 .active 类

javascript - 列表中间的中心图像有 50% 悬垂

php - azure 托管 Web 应用程序上的 html 联系表单

javascript - 用子元素的值替换元素文本

javascript - HTML 中的 JS 时间显示单位数分钟

javascript - 视差滚动背景图像自动放大和缩小

html - 如何在使用 css 表格时对齐 div 元素

html - 为什么 BootStrap 列偏移不起作用?

javascript - 我可以使用 CSS direction 来定位元素的滚动条吗?

javascript - 如何将 RGBA 背景放在图像或 div 区域上方?