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?

Recommended Answers

All 2 Replies

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>
commented: I imagined something very complicated. Thank you! +0

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.