7 replies [Last post]
Luke2000
Offline
Enthusiast
Last seen: 15 years 11 weeks ago
Joined: 2005-09-16
Posts: 72
Points: 0

Is it posiible to have two CSS font styles on the same row of text? Suppose I should elaborate... lol. I'll show you what I want in straight xhtml format below (as the <font> tag is deprecated I do not want to use it though).

<p><font color="red">Red text. </font color><font color="black">Black text.</font color></p>

This would all appear on the same line, or atleast in same paragraph. All I can seem to do with CSS at the moment is this (using a previously specified external style sheet obviously):

<p id="red">Red text. </p><p id="black">Black text.</p>

This obviously splits the text into two paragraphs. I am sure I am missing something very obvious. Any suggestions?

Thankyou.

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 6 years 7 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Re: {UPDATED}Styles within styles or help in any other way..

<p id="red">Red text. <span class="black">Black text.</span></p>

Spans are used for introducing different styles inline to block level elements like paragraphs, headers etc.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

Luke2000
Offline
Enthusiast
Last seen: 15 years 11 weeks ago
Joined: 2005-09-16
Posts: 72
Points: 0

Thankyou

So what would be the related CSS style sheet code to control a span? span.black { color: black } ?

wolfcry911
wolfcry911's picture
Offline
Guru
MA, USA
Last seen: 6 years 39 weeks ago
MA, USA
Timezone: GMT-5
Joined: 2004-09-01
Posts: 3224
Points: 237

{RESOLVED}Styles within styles or help in any other way...

You're NOT using font tags, are you? Please tell me you're not - wait - no - NO!!! You are using font tags. They've been deprecated forever in favor of - you guessed it - CSS.

Luke2000
Offline
Enthusiast
Last seen: 15 years 11 weeks ago
Joined: 2005-09-16
Posts: 72
Points: 0

:P

....as the <font> tag is deprecated I do not want to use it though).

Sound familiar Mr. Wolf? Read my first post again... lol Tongue

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 6 years 7 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Re: Thankyou

Luke2000 wrote:
So what would be the related CSS style sheet code to control a span? span.black { color: black } ?

Yes, that's right.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

wolfcry911
wolfcry911's picture
Offline
Guru
MA, USA
Last seen: 6 years 39 weeks ago
MA, USA
Timezone: GMT-5
Joined: 2004-09-01
Posts: 3224
Points: 237

{RESOLVED}Styles within styles or help in any other way...

Luke, I am your father - no, wrong reality...

You got me, I didn't thoroughly read your OT. My apologies Cool

Luke: 1 Wolf: 0 Sad

Luke2000
Offline
Enthusiast
Last seen: 15 years 11 weeks ago
Joined: 2005-09-16
Posts: 72
Points: 0

LOl....

If I could walk the skies I wouldn't be wasting my time with CSS and XHTML....

And it isn't a competition Laughing out loud

No probs Mr. Wolf.

Thanks again Tyssen Laughing out loud