[Last Call] Learn how to a build a cloud-first strategyRegister Now


Using inline styles to change text characteristics mid paragraph

Posted on 2012-08-13
Medium Priority
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

Accepted Solution

mvdeveloper earned 132 total points
ID: 38288849
Some normal and <span style="color:red">Some Red</span> text.

Assisted Solution

WebDevEM earned 132 total points
ID: 38288850
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

jtwcs earned 136 total points
ID: 38288854
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


Author Comment

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


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
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 …
Suggested Courses
Course of the Month17 days, 21 hours left to enroll

830 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