473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

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 5713


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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Peter King | last post by:
if you assign multiple classes in order to keep your classes generic e.g ..classA { position.absolute; left:5 top:5 height:200 width:800 } ..classB { background-color: red} ..classC {...
3
by: hutch | last post by:
Hi, I'm making use of this VERY useful function for a so called 'standards compliant' replacement for target="_blank": function externalLinks() { if (!document.getElementsByTagName) return;...
4
by: Andy Sutorius | last post by:
Hi, I have a folder with a web.config file using forms authentication thus requiring that folder to be an IIS application. When I attempt to visit a webpage in that folder, default.aspx, I...
0
by: xs | last post by:
I have a master page which has a class name "GlobalPage" created in Web namespace. I created a string property called connectionString in this GlobalPage class. I have a ascx control loaded in...
4
by: bill tie | last post by:
I'm trying to re-construct missing classes in somebody else's code. Salient points: Dictionary<string, Projectprojects = new Dictionary<string, Project>(); .... WeeklyAggregation aggregation...
5
by: dominik lenné | last post by:
Hi, it would be useful to have a pseudoclass which applies between the time, a link has been clicked on and the time, the next link on the same page has been clicked on. Imagine a navigation...
5
by: garfy | last post by:
Hi i get this error in validation Line 22 column 6: document type does not allow element "title" here. <title>Seo Web Design Los Angeles - Web Design And Search Engine Optimization L ...
9
by: Mahernoz | last post by:
Hello Friends, The JavaScript File exmplmenu_var.js contains the code... (for the sake of brevity i am showing only that code which needs to be changed) I am actually developing a menu using...
0
by: tgkprog | last post by:
hi i'm trying to use Win32::IEAutomation to automate clickbank.com navigation and page saving i can login and go to the https://www.clickbank.com/account/showTransactions.htm page but cannot...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.