开发者

How to prevent a line break in a html link?

开发者 https://www.devze.com 2022-12-29 18:14 出处:网络
that is, a whole html link, must开发者_C百科 be in line1 or line 2. not in two lines.According to this post:

that is, a whole html link, must开发者_C百科 be in line1 or line 2. not in two lines.


According to this post:

NOBR Tag not suppored by W3C. So use the alternative tag for it. Instead of giving NOBR tag give the tag as style="white-space: nowrap".

So that would mean you should say:

<a style="white-space: nowrap">link</a>

Or even better, put it inside your CSS:

a { white-space: nowrap; }


Using CSS:

a {
    white-space: nowrap;
}

This will prevent line breaks in any A tags.


You can use <a><nobr>link</nobr></a>

Please note: This will work but is not officially supported by the W3C spec.


none of that worked for me. I used a display:inline style and solved it


By using 'text-decoration-line:none' in your styling you can replace the pre made line below a link tag. Here is the example of this

This will work

`<a href="your_link_here" style="text-decoration-line: none;">Home</a>`

or

you can also try this one if you are using external stylesheet:

a{text-decoration-line: none;}
0

精彩评论

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