Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > CSS: "tagname.classname" or ".classname"

Reply
Thread Tools

CSS: "tagname.classname" or ".classname"

 
 
Ante Perkovic
Guest
Posts: n/a
 
      12-22-2003
Hi,

Sorry if this is OT

I have some old CSS files that have all class names preceded with
tagname, like "TD.verysmall" or "span.important". I'm exeprimenting
with Dreamwiever and I noticed that, when making new class, DW doesn't
ask me for which tag it is. I also noticed that classes in some
template css files don't have tagnames in front.

So, should I make classes with or without tagnames in front?

Thanks,
Ante
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-22-2003


Ante Perkovic wrote:


> Sorry if this is OT


Try a group on stylesheets if you have a CSS question.

> I have some old CSS files that have all class names preceded with
> tagname, like "TD.verysmall" or "span.important". I'm exeprimenting
> with Dreamwiever and I noticed that, when making new class, DW doesn't
> ask me for which tag it is. I also noticed that classes in some
> template css files don't have tagnames in front.
>
> So, should I make classes with or without tagnames in front?


CSS doesn't allow you to "make classes", it allows you to write rules
with selectors, if you have a selector
.classname
then the rule applies to all elements having the class attribute set to
include that class name e.g to
<p class="classname">
as well as
<span class="classname">
If you use
elementname.classname
e.g.
p.classname
then the rule only applies to <p> elements but not <span> elements.
Which selector to choose depends on your needs.

--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
 
 
 
DU
Guest
Posts: n/a
 
      12-25-2003
Ante Perkovic wrote:

> Hi,
>
> Sorry if this is OT
>
> I have some old CSS files that have all class names preceded with
> tagname, like "TD.verysmall" or "span.important". I'm exeprimenting
> with Dreamwiever and I noticed that, when making new class, DW doesn't
> ask me for which tag it is. I also noticed that classes in some
> template css files don't have tagnames in front.
>
> So, should I make classes with or without tagnames in front?
>
> Thanks,
> Ante


Maybe I'm a bit off-topic here but you may want to read these because
they address the question you have:

"How to write the perfect style sheet - always looks perfect, whatever
the browser; easy to maintain; quick to download"
http://richinstyle.com/masterclass/perfection.html
IMO, unsurpassed and excellent.

Guidelines for Efficient CSS
http://www.mozilla.org/xpfe/goodcss.html

DU

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments