Reply LinkBack Thread Tools Search this Thread
Old 05-12-2003, 12:45   #1 (permalink)
roto
This is it - ground zero.
 
roto's Avatar
 
Join Date: Apr 2003
Location: Paper St.
Posts: 4,200
Send a message via AIM to roto Send a message via Yahoo to roto
<span> Tags...the best way to format a style within a style?

Ok, I'll just get right into a question I'm sure is rather rudimentary...I have a td with a certain class defined (for this example, it is for the text contained within it) and I want to change one word to red (for this example)...

The classes are:
.text { font-family:verdana; color:#000000; }
.textred { font-family:verdana; color:#FF0000; }

Would the following be the best way to do it:
Code:
blah blah blah before code <td class="text"> This text is black according to the "text" class...but I need this <span class="textred">word</span> to be red. </td> blah blah blah after code

I really don't want to use flash or read a book, and I also don't want annoying <span> tags everywhere in my code -- they remind too much of even more annoying <font> tags. This has always bothered me, but if this is the accepted way to do it, then so be it and I will let it rest.
__________________
fun: HGC v.4 | last.fm: DT | me | oi! f*ck u roto: ...via meebo!

New to interweb design? Your friends at dt can help.
  Reply With Quote
Old 05-12-2003, 12:55   #2 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,236
If you're doing it to emphasis the text use the <em> tag and style it.

em {
color: red;
font-weight: normal;
}
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 05-12-2003, 14:27   #3 (permalink)
roto
This is it - ground zero.
 
roto's Avatar
 
Join Date: Apr 2003
Location: Paper St.
Posts: 4,200
Send a message via AIM to roto Send a message via Yahoo to roto
nope, just red...
__________________
fun: HGC v.4 | last.fm: DT | me | oi! f*ck u roto: ...via meebo!

New to interweb design? Your friends at dt can help.
  Reply With Quote
Old 05-12-2003, 14:34   #4 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,236
Then just use a span.
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 05-12-2003, 16:40   #5 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,901
Nah, you were right first time, sb.

<span> tags may appear useful, but they are meaningless.
They're certainly not 'the best way' to achieve what you're after, oto.
Use styled <em> tag as sb suggested and it'll emphasise the red word in other circumstances too.

Whenever possible, use meaningful tags in your markup, not meaningless ones.
Why are you emphasising the word in the first place?
  Reply With Quote
Old 05-12-2003, 22:28   #6 (permalink)
roto
This is it - ground zero.
 
roto's Avatar
 
Join Date: Apr 2003
Location: Paper St.
Posts: 4,200
Send a message via AIM to roto Send a message via Yahoo to roto
It is just a theoretical question. I'm more after WHAT would be the best way to JUST make the text RED (not italic) and/or the best way to accomplish adding a different style within a style. If <span> tags are meaningless, I'm asking about substitutes, and IF they are meaningless...why do they exist? I'm curious...
__________________
fun: HGC v.4 | last.fm: DT | me | oi! f*ck u roto: ...via meebo!

New to interweb design? Your friends at dt can help.
  Reply With Quote
Old 06-12-2003, 02:39   #7 (permalink)
gwx
Dr. Macromedia
 
gwx's Avatar
 
Join Date: Dec 2003
Location: Alpha Centauri
Posts: 106
Send a message via MSN to gwx
compatiblity?

Ermm... Do <span> Tags work in IE and NN7? I thought they only work in Netscape 4xx?
  Reply With Quote
Old 06-12-2003, 05:47   #8 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
they work for all.

span tags are meaningless when taken away from a stylesheet. stylesheets are there to seperate style from content. take a look at your markup without the style sheet attached. if you use a styled <em> tag then your browser will still know to give emphasis to this word. if you're not wanting to put the word in red for emphasis then why is it highlighted in red? surely you are emphasising the word's existance on the page?

this can't be a theoretical question.
  Reply With Quote
Old 06-12-2003, 05:48   #9 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,236
Quote:
Originally Posted by ®oto
It is just a theoretical question. I'm more after WHAT would be the best way to JUST make the text RED (not italic) and/or the best way to accomplish adding a different style within a style. If <span> tags are meaningless, I'm asking about substitutes, and IF they are meaningless...why do they exist? I'm curious...

<em> is not <i>. It just so happens that <em>'s default weight is set to italics. The point that I, and Bill after me, was making is that by making a certain word within a paragraph red you ARE emphasising it, even if you don't realise, and therefore should us the proper markup.
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 06-12-2003, 05:49   #10 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
must be something in the hat?
  Reply With Quote
Old 06-12-2003, 05:55   #11 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,236
That wasn't you outside my window lastnight was it!?
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 06-12-2003, 06:02   #12 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,214
shaking the tree
  Reply With Quote
Old 06-12-2003, 06:02   #13 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,901
jftr, <span> tags were devised with a 'structural' effect in mind, but will also support the 'presentational' effect you want.
Seeing as you are creating a presentational emphasis rather than a structural one, it is recommended that you use a semantic, presentational tag (i.e. <em>) as these tags can then be used to emphasise that text in alternative web reading/browing software (i.e. Lynx, Jaws, ...).

Or to put it another way...

ditto.


[edit]

That'll learn me to have breakfast mid-post

[/edit]
  Reply With Quote
Old 06-12-2003, 07:35   #14 (permalink)
gwx
Dr. Macromedia
 
gwx's Avatar
 
Join Date: Dec 2003
Location: Alpha Centauri
Posts: 106
Send a message via MSN to gwx
Should use <span> or <div>?
  Reply With Quote
Old 06-12-2003, 07:39   #15 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,901
Should read the thread properly.

> > Should use <em>
  Reply With Quote
Old 06-12-2003, 07:40   #16 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,236
Quote:
Originally Posted by gwx
Should use <span> or <div>?

should I use a fork or spoon? It depends what you're eating!

</wise monkey>
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 06-12-2003, 07:54   #17 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,236
Or

div is for block level elements, span is for inline elements.
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 06-12-2003, 08:32   #18 (permalink)
roto
This is it - ground zero.
 
roto's Avatar
 
Join Date: Apr 2003
Location: Paper St.
Posts: 4,200
Send a message via AIM to roto Send a message via Yahoo to roto
Alright...it all makes more sense now...TA

(and it doesn't seem like such a basic/rudimentary question anymore)
__________________
fun: HGC v.4 | last.fm: DT | me | oi! f*ck u roto: ...via meebo!

New to interweb design? Your friends at dt can help.
  Reply With Quote
Old 06-12-2003, 12:43   #19 (permalink)
gwx
Dr. Macromedia
 
gwx's Avatar
 
Join Date: Dec 2003
Location: Alpha Centauri
Posts: 106
Send a message via MSN to gwx
smallbeer, u have a queer way with words
  Reply With Quote
Old 06-12-2003, 13:10   #20 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,901
gwx, 'smallbeer' is rhyming slang where sb comes from.
Right, sb?

  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8