How to reduce background-color width of a text?

i’m practicing css

What have you tried?

It’s best if you provide a link to your live code so we can see what you’ve tried and help guide you from there rather than just giving you an answer.

use this code <p style="color:red; background-color: #03fc98; display:inline;"><b>I'm a level one heading</b></p>

for more methods , ref this link

Usually, you would set the display to inline-block, and not inline. With inline-block, you keep the top/bottom margin. Which you will most likely want with a heading element.

Just as an aside, don’t use inline styles (styles applied on the element using the style attribute) it just makes the CSS unmanageable.

1 Like

i don’t try something cause i don’t know about a tag that can made it …