[英]How can I break all lines or none in inline CSS?
I am designing an HTML email for a company. 我正在为一家公司设计HTML电子邮件。 I'm having a problem with the footer at the bottom.
我底部的页脚有问题。 Currently, it looks like this:
当前,它看起来像这样:
I love it! 我喜欢它!
When it's resized a lot, it looks like this: 调整大小后,它看起来像这样:
Wonderful! 精彩! I DO want the footer to break onto 3 lines.
我确实希望页脚分成3行。
However, when I resize the window halfway, it looks like this: 但是,当我将窗口的大小调整一半时,它看起来像这样:
What CSS code can I use to make the footer to either break ALL lines, or none? 我可以使用哪种CSS代码来使页脚中断所有行,或者什么都不行? It needs to ALWAYS look like either this:
它总是需要如下所示:
or this: 或这个:
But NEVER this: 但是永远不要这样:
and NEVER this: 而且永远不要这样:
I tried numerous combinations of white-space: nowrap;
我尝试了多种
white-space: nowrap;
组合white-space: nowrap;
to no avail. 无济于事。 When ANY lines break, they need to ALL break at the same time.
当任何行中断时,它们需要同时全部中断。 Maybe this could be accomplished with a
<table>
? 也许可以用
<table>
?
Thank you for your help. 谢谢您的帮助。 The CSS needs to be inline and without media queries.
CSS需要是内联的,并且没有媒体查询。 JavaScript support for HTML email is very limited and non-reliable, therefore, I wish to do without it.
JavaScript对HTML电子邮件的支持非常有限且不可靠,因此,我希望没有它。
A JSFIDDLE for editing can be found here. 可以在此处找到用于编辑的JSFIDDLE。
The layout which you are trying is possible using media queries or javascript. 您尝试使用的布局可以使用媒体查询或JavaScript。 but most of the email templates doesn't support both solutions.
但是大多数电子邮件模板都不支持这两种解决方案。
So, as I see, you have two options: 因此,正如我所看到的,您有两个选择:
br
tags between the nav
tags. nav
标签之间添加br
标签。 Personal suggestion: I would have gone with the first option. 个人建议:我会选择第一种选择。
<nav style="display:inline; white-space:nowrap;">
<a moz-do-not-send="true" style="text-decoration:none; word-break:break-all; color:white;" href="tel:1234567890">
(123) 456-7890
</a>
</nav>
Use 使用
word-break:break-all;
Jsfiddle 杰斯菲德尔
http://jsfiddle.net/f1uuwexy/8/ http://jsfiddle.net/f1uuwexy/8/
You can do this using only html: 您可以仅使用html来做到这一点:
<div>
www.hazardmoving.com<br />
Patrickhazard@yahoo.com<br />
(123) 456 7890<br /></div>
You seem to try pushing css beyond its limits 您似乎尝试将CSS推到其极限之外
If you feel comfortable including bootstrap you can try: 如果您喜欢使用引导程序,可以尝试:
<link rel="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
<div style="width: 600px; margin: 60px auto; text-align: center;">
<div class="col-md-4">www.hazardmoving.com</div>
<div class="col-md-4">Patrickhazard@yahoo.com</div>
<div class="col-md-4">(123) 456 7890</div>
</div>
That should do the work. 那应该做的工作。 Check my pen:
检查我的笔:
http://codepen.io/anon/pen/EajwXp http://codepen.io/anon/pen/EajwXp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.