【发布时间】:2013-03-31 17:33:51
【问题描述】:
我在 4 个段落的末尾有一个链接。比如:
Here is my text, and it's just an example of text to show
And I am wanting to wrap the last bit of text, which happens
to be a link, but I need the link to either stay on the line
that is the available width and not break to another line,
unless it can't fit left-aligned on that line like this
http://mylink.com
因此,HTML 中的实际代码如下:
<p>Here is my text, and it's just an example of text to show
And I am wanting to wrap the last bit of text, which happens
to be a link, but I need the link to either stay on the line
that is the available width and not break to another line,
unless it can't fit left-aligned on that line like this<br />
<a href="http://mylink.com">http://mylink.com</a></p>
我在这里使用<br />,但我不想使用<br />,因为屏幕会捕获实际显示的文本量,有时它可能看起来像这样:
Here is my text, and it's just an example of text to show And I am wanting to wrap
the last bit of text, which happens to be a link, but I need the link to either stay
on the line that is the available width and not break to another line, unless it can't
fit left-aligned on that line like this
http://mylink.com
因此,在上述情况下,我需要它不要使用 <br /> 标记来分解它,而是应该像这样呈现:
Here is my text, and it's just an example of text to show And I am wanting to wrap
the last bit of text, which happens to be a link, but I need the link to either stay
on the line that is the available width and not break to another line, unless it can't
fit left-aligned on that line like this http://mylink.com
这可以通过 CSS 实现吗?可能是一些text-align 值,或者为了在不使用<br /> 标记的情况下完成此任务?但是,如果链接可以自然地放在行上,那么它不应该向下移动到下一行。相反,它应该保持在那条线上。
谢谢!
【问题讨论】:
标签: css line-breaks word-wrap