简体   繁体   English

如何响应性地均匀分布文本?

[英]How to evenly distribute text responsively?

I am having issues at work today and I am trying to responsively spread these 3 text boxes across the screen, one to the left maybe with a little padding pushing away from the left, one in the centre, and one to the right and also with padding pushing away from the right.我今天在工作中遇到问题,我正在尝试将这 3 个文本框响应性地分布在屏幕上,一个向左可能有一点填充物从左侧推开,一个在中心,一个在右侧,还有填充远离右侧。

I have used many solutions, the reason this doesn't work when it works on my screen every time is because it goes through IE HTML and then gets displayed on an email so it must go through a specific conversion.我使用过很多解决方案,每次都在我的屏幕上运行时它不起作用的原因是因为它通过 IE HTML 然后显示在电子邮件上,因此它必须经过特定的转换。

I have a feeling that this could also be an older/outdated version of HTML as everything is purely HTML based.我有一种感觉,这也可能是一个较旧/过时的 HTML 版本,因为一切都纯粹基于 HTML。

        <div class="awards" style="display: flex; float: float;">
        <div>silver</div>
        <div>gold</div>
        <div>platinum</div>
    </div>

Here is the text boxes, I will try what you guys come up with / recommend, thanks.这是文本框,我会尝试你们提出/推荐的内容,谢谢。

Even to this day, CSS Flexbox support is not universally supported across email clients and the most reliable method is a three column table with 33% width on the cells.直到今天,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>

If you were going to do it with flex it'd be something like:如果你打算用 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM