We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,672 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Two classes in one div?

What I want to accomplish is to have one division with the first part of the text red and the second part green. How would I do that?

3
Contributors
2
Replies
32 Minutes
Discussion Span
11 Months Ago
Last Updated
3
Views
efth
Newbie Poster
21 posts since May 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

You mean that you wnt to have the first part of a text green and the second red

//add your css
<style>

#green p{color:green;}
#red   p{color :red;}

</style>
<div id="main">

    <div id="green">
    <p>Hello</p>
    </div>

    <div id="red">
    <p>World</p>
    </div>

</div>
dany12
Posting Whiz in Training
223 posts since Aug 2010
Reputation Points: 21
Solved Threads: 15
Skill Endorsements: 1

If one div is required, you can place a span element around the text that you want to format differently, then apply a style on that span element. Or you can do this with jQuery. Please clarify exactly what you are trying to do.

JorgeM
Senior Poster
3,998 posts since Dec 2011
Reputation Points: 294
Solved Threads: 543
Skill Endorsements: 115

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0583 seconds using 2.68MB