HTML锚标记中的超链接文本的内联包装

Ton*_*ony 9 html css formatting hyperlink

我正在尝试找到一种方法,允许在HTML链接中包含非常长的文本,同时在紧凑的矩形中包含链接.

基本上,我想要这个:

                      with a really, really
    Here is some text long link that wraps   and here is some more text.
                      around in a rectangle

代替:

   Here is some text with a really, really long link that wraps
   around in a rectangle and here is some more text.

我怎样才能做到这一点?

Gre*_*reg 10

你可以在Firefox中这样做 - 它虽然在IE中不起作用:(

<p>Here is some text <a href="#">with a really, really long link that wraps</a> around in a rectangle and here is some more text.


<style type="text/css">

a {display: inline-block; max-width: 100px; vertical-align: middle;}

</style>
Run Code Online (Sandbox Code Playgroud)

  • IE FIX:*显示:内联;*zoom:1; 搞定了!:) (2认同)

小智 9

我知道这已经很老了,但它仍然是我在这个主题上提出的第一批搜索结果之一.我发现使用:

white-space: pre-wrap;
Run Code Online (Sandbox Code Playgroud)

强制锚点围绕我的宽度限制包装文本