开发者

Stop wrapping of hyphenated text?

开发者 https://www.devze.com 2022-12-13 21:02 出处:网络
I have a 开发者_Python百科bunch of links in a div. Some have format \"some-name\". those with hyphen will split and wrap. I would like it to start a new line. How to do this please?You can use a non-b

I have a 开发者_Python百科bunch of links in a div. Some have format "some-name". those with hyphen will split and wrap. I would like it to start a new line. How to do this please?


You can use a non-breaking hyphen character, ‑


You can use the CSS attribute: white-space:nowrap; But note that it is not working all the time on some browser.

The other option is to wrap your link into a <pre> element but this approach can have some side effects as well.


<span style="white-space: nowrap;">some-name</span>


turn off formatting with

<pre>...</pre>


You can also do this:

<nobr>Table-text</nobr>

Reference:

How to prevent line break at hyphens on all browsers

0

精彩评论

暂无评论...
验证码 换一张
取 消