469,312 Members | 2,524 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,312 developers. It's quick & easy.

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

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
Jul 20 '05 #1
3 5502


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/

Jul 20 '05 #2
In article <f7**************************@posting.google.com >,
an**********@vip.hr (Ante Perkovic) writes:

Sorry if this is OT :(
Yes it is. comp.info.www.authoring.stylesheets
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.
You mean DW finally got something right?
So, should I make classes with or without tagnames in front?


That depends on whether you want to use the class with any element or only with
certain elements.
--
Randy
Jul 20 '05 #3
DU
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

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Andy Sutorius | last post: by
4 posts views Thread by bill tie | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.