I am trying to add color to the second half of header text to highlight some words. Any ideas?

2 answers

o.k.w 2355
2
points

Not too sure what do you mean by header text, I assume you are refering to the text enclosed with heading tags e.g. <h1>, <h2>, <h3> etc

And I also assume adding color is to change the color of the text, not any other effects like outline, background etc.

To have different text colors within the heading tags, you can add a <span> element to enclose the text you want to apply the color.

<h1>This is my heading text, <span>here is the second half</span></h1>

h1 {color: blue;}
h1 span {color: red;}

The above method is just one of many ways to do it.

Answered almost 7 years ago by o.k.w
BPartch 342
1
point
<p>This is <span>some highlighted text</span></p>

p span{
  font-weight:bold;
  color:#ff0000;
}

Is this what you mean?

Answered almost 7 years ago by BPartch