Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent a line break in a html link?

Tags:

html

css

that is, a whole html link, must be in line1 or line 2. not in two lines.

like image 502
lovespring Avatar asked May 11 '10 13:05

lovespring


People also ask

How do I stop a line breaking in HTML?

The <nobr> HTML element prevents the text it contains from automatically wrapping across multiple lines, potentially resulting in the user having to scroll horizontally to see the entire width of the text.

How do you prevent line breaks?

Use white-space: nowrap; or give that link more space by setting li 's width to greater values. I prevented line break in li items using display: inline; . Maybe this will also help others with similar problems. Its important to be careful with display: inline as it can have side effects.

How do you make something stay on the same line in HTML?

To get all elements to appear on one line the easiest way is to: Set white-space property to nowrap on a parent element; Have display: inline-block set on all child elements.

What is a line break in URL?

URL Line BreaksAfter a colon or double slash (//)


1 Answers

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; } 
like image 116
Justin Ethier Avatar answered Sep 20 '22 16:09

Justin Ethier