Using inline styles to change text characteristics mid paragraph

I have a paragraph wrapped with

The trouble is need to change two words in one sentence to red italic.

My code looks something like this:

<p class="txt">
     blah blah blah <style="color: red; font-style: italic;">blah blah</style> blah blah blah
</p>

Open in new window


This, of course doesn't work because I don't have a selector like p in front of "style".  The thing is, I'm not sure what selector to use there.  

What selector can I use?
LVL 1
Azra LyndseyNerdAsked:
Who is Participating?
 
mvdeveloperCommented:
span.
Some normal and <span style="color:red">Some Red</span> text.
0
 
WebDevEMCommented:
If you wrap it in a span, you can set the style on that

<p class="txt">
     blah blah blah <SPAN style="color: red; font-style: italic;">blah blah</SPAN> blah blah blah
</p>
0
 
jtwcsCommented:
Wrap the two words with a <span> tag.

<p class="txt">
     blah blah blah <span style="color: red; font-style: italic;">blah blah</span> blah blah blah
</p>

Open in new window

0
 
Azra LyndseyNerdAuthor Commented:
!!!  I knew that I was missing something silly like that.  I just couldn't remember what it was  Ha!

Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.