The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> CSS Help
|
Is there a "neutral" HTML tag to hold CSS class or id specification ?
Discuss Is there a "neutral" HTML tag to hold CSS class or id specification ? in the CSS Help forum on Dev Shed. Is there a "neutral" HTML tag to hold CSS class or id specification ? Cascading Style Sheets (CSS) forum discussing all levels of CSS, including CSS1, CSS2 and CSS Positioning. CSS provides a robust way of applying standardized design concepts to your web pages.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

July 27th, 2001, 09:46 AM
|
|
Contributing User
|
|
Join Date: Jan 2001
Location: In a multi-cultural mess.
Posts: 569
Time spent in forums: 1 h 59 m 30 sec
Reputation Power: 13
|
|
|
Is there a "neutral" HTML tag to hold CSS class or id specification ?
I have a paragraph --
<p>Now is the time for all good men...</p>
Several phrases are highlighted with color --
<p>Now is the <font color="red">time</font> for
all <font color="green">good</font> men ...</p>
I want to use css instead of the font tag.
I can use <i> or <b> tags with "css id or class" --
<p>Now is the <i id="myRed">time</i> for
all <b id="myGreen">good</b> men ...</p>
My question -- Is there a tag that does nothing?
Just allows you to invoke some css id or class?
What "neutral" tag can I use in place of the following question marks?
<??? id="myRed">
I feel like I am missing the obvious way to do this ( without <font> ).
Robert
__________________
Robert
---
If it's hard, it's probably wrong.
|

July 27th, 2001, 09:55 AM
|
 |
A PAtCHy sErver
|
|
Join Date: Jun 2001
Location: Italy
Posts: 408
Time spent in forums: 2 m 27 sec
Reputation Power: 12
|
|
|
Try something like this:
<span class="green">my text in green</span>
|

July 27th, 2001, 10:13 AM
|
|
Junior Member
|
|
Join Date: Jul 2001
Location: Pittsburgh, PA, USA
Posts: 13
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
or:
<div id="myRed">text</div>
|

July 27th, 2001, 10:41 AM
|
|
Contributing User
|
|
Join Date: Jan 2001
Location: In a multi-cultural mess.
Posts: 569
Time spent in forums: 1 h 59 m 30 sec
Reputation Power: 13
|
|
|
dunxster and pippo,
Thanks for the ideas. I tried the following on NN4.7
Now is the <span id="bfgRed">time</span> for all <div id="bfgGreen">good</div> men to ...
<span... was ignored.
<div... made the word "good" green, but isolated "good" on a separate line.
Maybe it would work on IE?
Perhaps the HTML authors didn't see a need for an "exit" or a "no operation" for css.
Robert
|

July 27th, 2001, 11:18 AM
|
|
CF sMod
|
|
Join Date: Jul 2000
Location: Maine, USA (a.k.a. Boonies)
Posts: 242
Time spent in forums: 6 m 43 sec
Reputation Power: 13
|
|
<span> is an inline element, you can have an unlimited amount of them on the same line.
<div> is a block-level element, you can only have one on a line (unless you change its style to display:inline).
Use <span>, NS4 has no problems with, perhaps it was something in your stylesheet which threw it, or perhaps it was the id attribute in the <span>? I know NS4 has no problems with <span class="bla">

|

July 27th, 2001, 07:05 PM
|
|
Junior Member
|
|
Join Date: Jul 2001
Location: Belgium
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
when to use SPAN or DIV tags
When using styles for fragment of text you use the SPAN-tag. If it's a complete block of text you want to manipulate, use the DIV-tag. This is very clear when you use the background-color property on those tags.
When using the SPAN-tags around one word, together with background-color, only that word will have the specified bg-color. When using the DIV-tag on that same word, the whole line will have that background-color.
|

July 28th, 2001, 12:27 PM
|
|
Contributing User
|
|
Join Date: Jan 2001
Location: In a multi-cultural mess.
Posts: 569
Time spent in forums: 1 h 59 m 30 sec
Reputation Power: 13
|
|
SPAN and DIV is right. css comments can't be //
Thank you all -- jakke, jkd, dunxster, pippo
You were right <span and <div do work as you said.
It was my error.
I had an invalid comment at the end of a css line as suggested
by jkd ( thank you  ). It negated the following css line.
So bfgRed was not recognized.
Yet bfgGreen was OK.
#fInDataHor {background-color: 33cc66; color: black; } // invalid comment
#bfgRed {color: ff0000;}
#bfgGreen {color: 00ff00;}
Robert
|

July 29th, 2001, 11:06 AM
|
|
Junior Member
|
|
Join Date: Jul 2001
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Hi Robert,
You can use <span>, for in-line formating (i.e. no caridge returns) or <div> for block formating. Neather of these tags have any formating other than layout, so all you'll need to do is set the color to red using css as other properties will be inherited from the <p> tag.
Hope this helps.
Pete.
|

July 30th, 2001, 05:40 AM
|
|
Web Weaver
|
|
Join Date: Dec 1999
Location: Australia
Posts: 64
Time spent in forums: < 1 sec
Reputation Power: 14
|
|
|
This may be a bit of a dumb question but how do you do a proper comment within CSS? I thought it was //...
__________________
Never say never.
|

July 30th, 2001, 06:00 AM
|
 |
Member
|
|
Join Date: Apr 2001
Posts: 15
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Comments in CSS are as follows:
/* some comment goes here */
/* this is another one */
|

July 30th, 2001, 08:12 AM
|
|
Web Weaver
|
|
Join Date: Dec 1999
Location: Australia
Posts: 64
Time spent in forums: < 1 sec
Reputation Power: 14
|
|
ah, I see now... thanks 
|

July 30th, 2001, 05:25 PM
|
|
Junior Member
|
|
Join Date: Jul 2001
Location: Belgium
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
/**************************************
you can always span this comment
over different lines ;-)
which is handy to subdivide a long Style Sheet
***************************************/
Last edited by jakke : July 30th, 2001 at 05:28 PM.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|