Facebook Pixel

How to Make Certain Words in a Headline Look Different

how to make certain words in a headline look different

You have probably spotted it on beautifully designed websites: a headline where one or two words are in italics, a different colour, or even a completely different font. It looks like magic, but it is actually one of the simplest CSS tricks you can learn.

The secret is a <span> tag with a class.

A <span> is an invisible wrapper you place around any word (or words) inside your HTML. On its own it does nothing. Once you give it a CSS class, you can style those specific words however you like, while the rest of the headline stays untouched.

The Basic Technique

Step 1: Wrap the word in a span

In your HTML, surround the word you want to style with an opening and closing span tag. Give it a class name of your choosing.

<h1>This is where <span class="highlight">cake</span> meets modern art</h1>

Step 2: Write a CSS rule for that class

In your stylesheet, write a rule using the class name you chose. Only the wrapped word will receive these styles.

.highlight {
  color: #C27A5B;
  font-style: italic;
}

That is it. Only the word “cake” gets the colour and italic treatment. Everything else in the heading is unaffected.

What can you change?

Inside your CSS rule you can mix and match properties. Use color for a different hue, font-style: italic for italics, font-weight: 700 for bold, or even font-family to switch to a completely different typeface for just those words.

Naming tip for classes: Call your class something descriptive, such as .highlight, .accent-word, or .fancy. No spaces, and always start the CSS rule with a full stop. The name in the <span class="..."> must exactly match the name in your CSS, including capitalisation.

How to Do This in WordPress

The exact same technique works in most WordPress themes, such as WordPress Elementor. You just need to know where to add the span and where to put your CSS. Here is how to do it step by step.

Step 1: Add your span tag in the text or headline widget

In Elementor, add a Text Editor or Heading widget to your page. The key is switching from the Visual editor to the HTML view; this is where you add your span tag directly.

Look for the Text tab at the top of the content editor in the left-hand panel and click it. You will now see the raw HTML. Wrap the word you want to style like this:

This is where <span class="highlight">cake</span> meets modern art

Switch back to the Visual view and the text will look normal for now. The styling comes in the next step.

Step 2: Where to add your CSS to change individual words in your headline

  1. Go to Appearance → Customize → Additional CSS in your WordPress dashboard.
  2. Add your CSS using the class name directly:
.highlight {
  color: #C27A5B;
  font-style: italic;
}

Alternatively, install the free Simple Custom CSS and JS plugin from the WordPress plugin directory. It gives you a dedicated editor at CSS & JS → Add Custom CSS and works the same way. If you use a modern WordPress theme, such as Divi, Astra, Elementor, you don’t need the extra plugin!!

Step 3: Apply it consistently across your site

If you want the same styled word effect used throughout your whole website, the best place to put your CSS is Appearance → Customize → Additional CSS (or Elementor Pro’s Site Settings → Custom CSS panel). Define the class once there, then simply add the <span class="highlight"> in whichever widgets you like. The styling follows automatically everywhere.

Quick note on the Heading widget: Elementor’s Heading widget does not Text tab for switching to HTML view. You can still add the CSS class to a standard Headline Widget. 

Which options can I change?

The following table shows you all the different options. Grab your brand colours in Photoshop or an online colour picker and use Hex Codes (a hex code is a colour that’s described like this: #C27A5B).

Use the EM value for font sizes as this translates better on mobile devices. I.e. avoid using font-sizes in px values, but use something like this: font-size: 1.2em;

For more options, check out W3Schools. Describe in Google or ChatGPT what you want to change, for example use this: “Give me the CSS for changing the text colour. 

 

Style propertyOptionsExample: What to add { inside the curly brackets } 
ColourAny hex code, colour name, or RGB valuecolor: #C27A5B;
Font stylenormal, italicfont-style: italic;
Font weight300 (light), 400 (normal), 700 (bold)font-weight: 700;
Font sizeAny value in px, em, or remfont-size: 1.2em;
Font familyAny font loaded on your sitefont-family: 'Playfair Display', serif;
Text decorationnone, underline, line-throughtext-decoration: underline;
Letter spacingAny value in px or emletter-spacing: 0.1em;
Text transformnone, uppercase, lowercase, capitalizetext-transform: uppercase;
Background colourAny hex code, colour name, or RGB valuebackground-color: #FAF0E6;

A Summary of Your Options

To recap, here is what you need at a glance:

  1. Wrap the words you want to style in <span class="your-class-name">...</span> inside your HTML or Elementor widget.
  2. Write a CSS rule using that class name to define the colour, style, weight, or font you want.
  3. Add the CSS via Dashboard → Appearance → Customize → Additional CSS.

That is all there is to it. Once you have written the class once, applying the effect to any headline on your site takes only a few seconds.

nadin 2026

Hi, I’m Nadin Thomson. I run Business Image Services Ltd, a web desgin & Local SEO agency in Dunfermline, Fife.

We design and support high-converting B2B websites for trades and service-based businesses across the UK.

Our work combines clear, customer-focused design, strong SEO foundations, and ongoing improvements that win trust and help turn visitors into enquiries.

I’ve been building websites since 1999, and for 20+ years I’ve helped organisations of all sizes improve their online presence with clear, strategic sites that generate leads.

I work in both English and German, which is helpful for clients who serve mixed-language audiences or want their messaging to feel natural in both languages.

I hold a university business degree and a postgraduate diploma in digital marketing.

Find out more about Business Image

Explore more

Stop renewing domain names Google doesn't care about
Is WordPress safe for my business website
How long does it take for a blog to get traffic?
How we launched a local business website in record time Thai Massage Stirling
How to fix an outdated website without a full redesign
Name servers, DNS & Hosting for beginners
How I write blog posts that rank actually in Google
WordPress 7.0 released 20 May 26
Does domain authority actually matter, or is it meaningless in 2026?
27 landing page optimisation tips that increase conversions