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

x
?
Solved

Using inline styles to change text characteristics mid paragraph

Posted on 2012-08-13
4
Medium Priority
?
327 Views
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
</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?
0
Comment
Question by:Azra Lyndsey
4 Comments
 
LVL 5

Accepted Solution

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

Assisted Solution

by:WebDevEM
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
</p>
0
 
LVL 10

Assisted Solution

by:jtwcs
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
</p>

Open in new window

0
 
LVL 1

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!

Thanks.
0

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