Using inline styles to change text characteristics mid paragraph

Posted on 2012-08-13
Last Modified: 2012-08-13
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

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?
Question by:Azra Lyndsey
    LVL 5

    Accepted Solution

    Some normal and <span style="color:red">Some Red</span> text.
    LVL 9

    Assisted Solution

    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
    LVL 10

    Assisted Solution

    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

    Open in new window

    LVL 1

    Author Comment

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


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Most web designers often experience crossbrowser issues during interface design / development.  On common problem is with Internet Explorer due to its rendering discrepancies between previous versions.  Here are some techniques I use to help avoid c…
    Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
    In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
    In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now