user6467650 user6467650 - 3 months ago 21
CSS Question

How to prevent splitting of anchor tag text across two lines while resizing?

I have an anchor tag where I display the name of the person logged in. The problem is that when I resize the browser window, the name gets split across two lines. How to prevent it?

Answer Source

Check out this JSFiddle. https://jsfiddle.net/rickydam/4xbztwbb/2/


HTML

<a href="https://rickydam.com" class="dontwrap"> Ricky Dam </a>

CSS

.dontwrap {
  white-space: nowrap;
}