[英]How to evenly distribute text responsively?
我今天在工作中遇到问题,我正在尝试将这 3 个文本框响应性地分布在屏幕上,一个向左可能有一点填充物从左侧推开,一个在中心,一个在右侧,还有填充远离右侧。
我使用过很多解决方案,每次都在我的屏幕上运行时它不起作用的原因是因为它通过 IE HTML 然后显示在电子邮件上,因此它必须经过特定的转换。
我有一种感觉,这也可能是一个较旧/过时的 HTML 版本,因为一切都纯粹基于 HTML。
<div class="awards" style="display: flex; float: float;">
<div>silver</div>
<div>gold</div>
<div>platinum</div>
</div>
这是文本框,我会尝试你们提出/推荐的内容,谢谢。
直到今天,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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.