我今天在工作中遇到问题,我试图以响应方式将这3个文本框分布在屏幕上,其中一个向左,可能有一点填充物从左侧推开,一个在中间,一个向右推以及将填充物从右侧推开。
我已经使用了许多解决方案,每次在屏幕上都无法显示时,该方法不起作用是因为它通过IE HTML,然后显示在电子邮件中,因此必须进行特定的转换。
我觉得这也可能是HTML的旧版/过时版本,因为所有内容都完全基于HTML。
<div class="awards" style="display: flex; float: float;">
<div>silver</div>
<div>gold</div>
<div>platinum</div>
</div>
这是文本框,我会尝试你们想出的/推荐的,谢谢。
答案 0 :(得分:1)
到目前为止,电子邮件客户端尚未普遍支持CSS Flexbox支持,而最可靠的方法是单元格上具有33%宽度的三列表格。
<style>
.table-awards {
width: 100%;
}
.table-awards td {
border: 1px solid black;
width: 33%;
}
.gold {background:silver;}
.silver {background:gold;}
.platinum {background:#eefeef;}
</style>
<table class="table-awards" style="width: 100%">
<tr>
<td class="gold" style="padding-left: 10px;">Silver</td>
<td class="silver" style="padding: 0 10px;">Gold</td>
<td class="platinum" style="padding-right: 10px;">Platinum</td>
</td>
</table>
如果要使用flex进行操作,则将类似于:
<style>
.awards {
display: flex;
justify-content:space-evenly;
}
.awards > div {
border: 1px solid black;
flex: 1;
}
.gold {background:silver;}
.silver {background:gold;}
.platinum {background:#eefeef;}
</style>
<div class="awards">
<div class="gold" style="margin-left: 10px;">silver</div>
<div class="silver" style="margin: 0 10px;">gold</div>
<div class="platinum" style="margin-right: 10px;">platinum</div>
</div>