调整大小的两个图像之间的html适合文本

标签 html css text center image-resizing

基本上我希望文本始终居中。两侧各有一个图像,可根据页面占用所有空白区域的大小调整大小。这是我目前所拥有的。

<div style="text-align:center;">
        <img style="float: left; width: 33%; margin:20px 0 0 0;" src="img/pulse.gif"/>
        <img style="float: right; width: 33%; margin:20px 0 0 0;" src="img/pulseR.gif"/>

        <h1 style="display:inline; vertical-align: middle; text-align: center; width: 33%;">Safety</h1>
    </div>

我想删除 width: 33% 并调整图像大小以适应空间。请记住,需要强制它保持在一条线上。

谢谢

最佳答案

您可以使用 tabletable-cell显示,或者只是经典的 html table

有使用 tabletable-cell 进行 显示 的示例(为图像添加了额外的 divs和标题):

.container
{
    width:100%;
    display:table;
    margin-top:20px;
}
.container div
{
    display:table-cell;
    text-align:center;
    vertical-align:top;
}
.container img
{
    width:100%;
    height:100%;
}
<div class="container">
    <div><img src="http://placehold.it/350x350"/></div>
    <div><h1>Safety</h1></div>
    <div><img src="http://placehold.it/350x350"/></div>
</div>

关于调整大小的两个图像之间的html适合文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32424957/

相关文章:

python - 在 pdfminer.six python 中保留提取文本的布局

C#PDFSharp : Examples of how to strip text from PDF?

html - 浏览按钮在 Internet Explorer 中以不同方式出现

javascript - 响应式导航菜单 Toggle'n

html - 使用 'float: left' 在 HTML 表格中列出图像

html - 机器人框架,如何检查类

css - 使用填充停止无序列表比父 div 高

html - 如何沿着 div 底部正确对齐不同大小的文本?

html - 使用 980px 的 Twitter Bootstrap

html - 如何访问 DOM 中 HTML 链接对象的颜色属性