Prevent line break between two elements in CSS
Posted
by Paul Alexander
on Stack Overflow
See other posts from Stack Overflow
or by Paul Alexander
Published on 2010-03-18T23:43:23Z
Indexed on
2010/03/18
23:51 UTC
Read the original article
Hit count: 423
css
|whitespace
For some basic layout work I'm doing, I'd like links that immediately follow a price to always be shown on the same line as the price. The price text is wrapped in a <span class="price">
tag while the link uses the buy-link class as in <a href="/buy" class="buy-link">Buy Now</a>
.
I'm looking for CSS that will automatically prevent line breaking between the span
and a
tag but I'm either missing something or it can't be done. I can easily prevent line breaks within the two tags - but not between them.
I want to avoid wrapping both tags in a span
with a white-space: nowrap
manually and use pure CSS if possible.
© Stack Overflow or respective owner