Reputation: 593
I would like to ask how can I give my text ONLY with the background-color property and not the spacing using CSS or HTML or both.
For example,
Hello everyone!
I only want the background-color to show on Hello and everyone! and not the entire length of Hello everyone!
I have tried searching in the Internet but I can't find any solution.
Thanks!
Upvotes: 1
Views: 104
Reputation: 7905
Wrap each word in a span element and give the span elements background colours.
Upvotes: 2
Reputation: 8054
There's a lot of different ways to do this, but for a beginner I'd recommend wrapping all text with <span>
.
Upvotes: 0
Reputation: 288710
Try placing your text inside a wrapper, and style it with
display: inline;
background-color: whatever;
Note that if you use a wrapper which is inline by default (e.g. <span>
), you don't need display: inline
.
Upvotes: 0