I have some links that I would like to prevent from being broken up when a wrap
is needed. I would rather the whole entire link be moved to another line rather than half of the link.
Here is an example
Is there any way to make a class only break 'full' if a word-break
is needed? (meaning that if the content of that class will exceed the lines, instead of breaking it, just create a new line with it).
I hope this makes sense; thank you for your time.
HTML
<div class="box">
Here is some text within this grey box; <a href="#">And here is the link</a>.
</div>
CSS
.box {
background: grey;
color: white;
line-height: 24px;
padding: 15px;
width: 290px;
}
.box a {
background: aqua;
color: black;
padding: 5px;
}
You are looking for white-space: nowrap
.
Updated Example
.box a {
white-space: nowrap;
background: aqua;
color: black;
padding: 5px;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With