Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

differnt style for text with css but not <P>

Status
Not open for further replies.

warby1212

Programmer
Jun 9, 2003
183
AU
HI,

I'm trying to have just a few words in some text with a diferent style (colour, bold). I know how to set the style of <P> in a style sheet but I don't want a new paragraph every time. I also want it in the stylesheet so I can set it for the whole website. should I be creating a class? I'm a bit lost.

Stephen (warby1212)
 
yup

use divs

#one {color: blue;}
#two {color: black;}

<DIV class=&quot;one&quot;>Here i am one text</DIV><DIV class=&quot;two&quot;>Here i am different text</DIV>

<Signature>
Sometimes the Answer You Are LOOKING for can be FOUND BY SEARCHING THE FAQ'S @&%$*#!!!
</Signature>
 
Actually <div>s (being block elements) will be much the same as <p>s. Try <span> tags for just a few words within a paragraph.

As in:
<style>
.green {color: green;}
.boldblue {color: blue; font-weight:bold;}
</style>
[tt]
<p>I'm trying to have just a few words in some text with a diferent style (<span class=&quot;green&quot;>colour</span>, <span class=&quot;boldblue&quot;>bold</span>). I know how to set the style of &lt;P&gt; in a style sheet but I don't want a new paragraph every time. I also want it in the stylesheet so I can set it for the whole website. should I be creating a class? I'm a bit lost.
[/tt]

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

AU.gif
Check out Tek-Tips Australia New Zealand forum1155
NZ.gif
 
Thanks for that, just what I was looking for. The trouble is it still goes to new line. Can I stop that?

Cheers
 
Yeah that's it <span> I knew it could be done.

Thanks heaps both of you.[thumbsup]
 
shoot i didnt even read the whole question -- after 3pm i just shut down :/

<Signature>
Sometimes the Answer You Are LOOKING for can be FOUND BY SEARCHING THE FAQ'S @&%$*#!!!
</Signature>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top