AMC AMC - 5 months ago 8
CSS Question

How do I style a specific word with CSS in an HTML element?

How do I style a specific word within

<p>
tags?
EX: STUDIO X is the best studio ever.

^^How do I, using css, make "STUDIO X" a different font than "is the best studio ever?"

Answer

You should do this:

HTML

<p>
    <span>STUDIO X</span> is the best studio ever
</p>

CSS

p {
font-size:12px;
}
    span {
    font-size:16px;
    font-weight:bold;
    }

I recommend you to define a specific class for <p> and <span> tags, it will prevent unexpected overwrites.

Comments