CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 3rd, 2004, 04:37 AM
duwgati duwgati is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 98 duwgati User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 46 m 58 sec
Reputation Power: 5
Question Advanced CSS syntax or omission??? Need clarification.

I was looking over the www.csszengarden.com page and the way CSS was used there, but now I'm puzzled about the way the p element & p class is used in that document.

In the stylesheet, the p element is specified but then in the html code, this type of code is used:
<p class="p1">
<p class="p2">
<p class="p3">

For each new paragraph the class p is incremented by 1.
However, the classes p1, p2, p3 etc. are not specified anywhere in the stylesheet.

Is it a correct use of CSS & html code, or are the 'missing' classes perhaps an omission?
Can anybody explain to me how this affects those paragraphs?

Reply With Quote
  #2  
Old March 3rd, 2004, 05:27 AM
Akh's Avatar
Akh Akh is offline
|<.+#f@#+.&.|
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2002
Location: norway
Posts: 2,685 Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 4 Weeks 6 h 6 m 4 sec
Reputation Power: 594
you should note that the markup at csszengraden have lots of extra classes, empty elements, so when making a layout for csszengarden you shouldn't be limited by the markup.
as you only can alter the css not the markup when submitting a layout for csszengarden.

and there is nothing wrong in declaring a class and not using it,
though if you have lots of that it might be come a bit untidy.

and instead of having a dozen classes like p1, p2 one could have used Adjacent sibling selectors but ofcourse that isn't supported in some browsers (read msie)

Reply With Quote
  #3  
Old March 3rd, 2004, 05:57 AM
duwgati duwgati is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 98 duwgati User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 46 m 58 sec
Reputation Power: 5
Thanks for your answer AKH, but it still leaves me with some questions.

Quote:
Originally Posted by Akh
and there is nothing wrong in declaring a class and not using it,
though if you have lots of that it might be come a bit untidy.


As I see it it is just the other way around. In the mentioned document, some of the classes that are used, are not specified in any stylesheet.

Quote:
Originally Posted by Akh
and instead of having a dozen classes like p1, p2 one could have used Adjacent sibling selectors but ofcourse that isn't supported in some browsers (read msie)


I probably haven't understood the concept of Adjecent Sibling Selectors correctly, but in the several documents about A.S.S. I didn't find any mention of using a class p1, p2, p3 etc. if they are not specified somewhere.

All info on A.S.S. that I found, assumes that the classes that are actually used, are specified explicitly in a style sheet.

Reply With Quote
  #4  
Old March 3rd, 2004, 06:23 AM
Glide Glide is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 56 Glide User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Quote:
Originally Posted by duwgati
Thanks for your answer AKH, but it still leaves me with some questions.



As I see it it is just the other way around. In the mentioned document, some of the classes that are used, are not specified in any stylesheet.



I probably haven't understood the concept of Adjecent Sibling Selectors correctly, but in the several documents about A.S.S. I didn't find any mention of using a class p1, p2, p3 etc. if they are not specified somewhere.

All info on A.S.S. that I found, assumes that the classes that are actually used, are specified explicitly in a style sheet.



Either way around doesn't really make any difference to the end page. You could put as many classes on a tag as you like and it won't make any difference to anything but the bandwidth of your site if they aren't defined in the stylesheet.

Similarly, you can define as many classes in the stylesheet as you wish and not use them in the tags. Again, it won't make any difference to the finished page other than bandwidth usage.

Is it good practise? Depends on what you need to achieve with your site. Bear in mind that the stylesheet is not the only thing to use classes, they can be useful in javascript as well as automated server scripts for checking pages for various properties.

With the A S S, you do have to specify it in the stylesheet (well in the style information at some point), but I think you may have misinterpreted the point he was making.

Last edited by Glide : March 3rd, 2004 at 06:26 AM.

Reply With Quote
  #5  
Old March 3rd, 2004, 06:44 AM
Akh's Avatar
Akh Akh is offline
|<.+#f@#+.&.|
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2002
Location: norway
Posts: 2,685 Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 4 Weeks 6 h 6 m 4 sec
Reputation Power: 594
what i ment was that they have added the extra classes in the markup,
so that you have a option to style them if you want, you shouldn't be limited by the html.
and you don't have to assign style even if there is a class there.
as i said when making a layout for csszengarden you can only alter the css,
not the markup.

normally you wouldn't add all those classes to your own markup,
as you usually have the same style on every paragraph, maybe just add classes to the exeptions.


as for Adjecent Sibling Selectors you can use them instead of placing
classes on each element,

like
p { /*some style */ }
p + p {/* a paragraph that comes after a paragraph has this style */ }


you can take a look at this example using a combination of Child selectors and Adjacent sibling selectors, to make a chessboard styled table ( works in mozilla, opera, konqueror )
http://test.9ls.org/css-examples/chess.html

Reply With Quote
  #6  
Old March 3rd, 2004, 06:52 AM
duwgati duwgati is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 98 duwgati User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 46 m 58 sec
Reputation Power: 5
Aha, now I understand. It seems I did indeed (as Glide suggested) misinterpret your first reply.

So the extra classes are just present in the html to offer the designers more flexibility.

Thanks fo clarifying

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > Advanced CSS syntax or omission??? Need clarification.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway