Web Hosting CSS & Stylesheet Forums

Add Me

User Name
Password
Go Back   CSS & Stylesheet Forums > CSS Forumz: Main > Style Sheet In General

Welcome to the CSS & Stylesheet Forums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags:



Reply
  #1 (permalink)  
Old 09-23-2008, 01:42 AM
shapper
Guest
 
Posts: n/a
Diggs:
Default Class Structure



Hello,

I have 3 type of h2 headers on my web site:

1 - Post titles on a blog (Ex: <h2>New documents available for
download</h2>)

2 - Content section title (Ex: <h2>Contacts</h2>)

3 - Sidebar content section title (Ex: <h2>Publicity</h2>)

I am trying to build my CSS to style the 3 different headers but I am
having some problems. I could use:
h2.Post, h2.Content and h2.Sidebar

or:
h2 (for maybe Post? This would be the base), h2.Content and h2.Sidebar

or even:
h2 (for Post), h2.Content for content and then h2.Sidebar to change
Content class so it fits Sidebar.

So a section in sidebar would be:
<h2 class = "Content Sidebar">Publicity</h2>

Could someone help me in deciding how should I structure my classes?

Thank You,
Miguel
Reply With Quote


Sponsored Links
  #2 (permalink)  
Old 09-23-2008, 01:42 AM
Jonathan N. Little
Guest
 
Posts: n/a
Diggs:
Default Re: Class Structure

shapper wrote:
> Hello,
>
> I have 3 type of h2 headers on my web site:
>
> 1 - Post titles on a blog (Ex: <h2>New documents available for
> download</h2>)
>
> 2 - Content section title (Ex: <h2>Contacts</h2>)
>
> 3 - Sidebar content section title (Ex: <h2>Publicity</h2>)
>
> I am trying to build my CSS to style the 3 different headers but I am
> having some problems. I could use:
> h2.Post, h2.Content and h2.Sidebar
>
> or:
> h2 (for maybe Post? This would be the base), h2.Content and h2.Sidebar
>
> or even:
> h2 (for Post), h2.Content for content and then h2.Sidebar to change
> Content class so it fits Sidebar.
>
> So a section in sidebar would be:
> <h2 class = "Content Sidebar">Publicity</h2>
>
> Could someone help me in deciding how should I structure my classes?
>
>


Well if each of these "sections" are defined with containing block then
I would apply the class to the container and differentiate the headings
with the "descendant selector"

http://www.w3.org/TR/CSS21/selector....dant-selectors

..sidebar h2 { /* headings for sidebars */--

..content h2 { /* headings for content area */--


<div class="sidebar">
<h2>This will have sidebar styling</h2>
<p>...</p>
</div>

<div class="content">
<h2>This will have content styling</h2>
<p>Some content...</p>
</div>

You do not have to put a class on every element...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Reply With Quote


  #3 (permalink)  
Old 09-23-2008, 01:42 AM
shapper
Guest
 
Posts: n/a
Diggs:
Default Re: Class Structure

On Sep 22, 2:56-pm, "Jonathan N. Little" <lws4...@central.net> wrote:
> shapper wrote:
> > Hello,

>
> > I have 3 type of h2 headers on my web site:

>
> > 1 - Post titles on a blog (Ex: <h2>New documents available for
> > download</h2>)

>
> > 2 - Content section title (Ex: <h2>Contacts</h2>)

>
> > 3 - Sidebar content section title (Ex: <h2>Publicity</h2>)

>
> > I am trying to build my CSS to style the 3 different headers but I am
> > having some problems. I could use:
> > h2.Post, h2.Content and h2.Sidebar

>
> > or:
> > h2 (for maybe Post? This would be the base), h2.Content and h2.Sidebar

>
> > or even:
> > h2 (for Post), h2.Content for content and then h2.Sidebar to change
> > Content class so it fits Sidebar.

>
> > So a section in sidebar would be:
> > <h2 class = "Content Sidebar">Publicity</h2>

>
> > Could someone help me in deciding how should I structure my classes?

>
> Well if each of these "sections" are defined with containing block then
> I would apply the class to the container and differentiate the headings
> with the "descendant selector"
>
> http://www.w3.org/TR/CSS21/selector....dant-selectors
>
> .sidebar h2 { /* headings for sidebars */--
>
> .content h2 { /* headings for content area */--
>
> <div class="sidebar">
> <h2>This will have sidebar styling</h2>
> <p>...</p>
> </div>
>
> <div class="content">
> <h2>This will have content styling</h2>
> <p>Some content...</p>
> </div>
>
> You do not have to put a class on every element...
>
> --
> Take care,
>
> Jonathan
> -------------------
> LITTLE WORKS STUDIOhttp://www.LittleWorksStudio.com


I see ... that is one approach ... I was also considering it.

Using your suggested approach I get my code more organized but longer
or not?

So you don't define default styles in your CSS (when I mean default I
don't mean the resulting from some Reset.css)

A side question: How do you organize your CSS? I usually use:

Typography, Layout, ...

So in Layout I would have:

div.Sidebar

and Typography I would have:

div.Sidebar h2

Or you put everything together?

Thanks,
Miguel
Reply With Quote


  #4 (permalink)  
Old 09-23-2008, 01:42 AM
Jonathan N. Little
Guest
 
Posts: n/a
Diggs:
Default Re: Class Structure

shapper wrote:
> On Sep 22, 2:56 pm, "Jonathan N. Little" <lws4...@central.net> wrote:


<snip>

>>> Could someone help me in deciding how should I structure my classes?

>> Well if each of these "sections" are defined with containing block then
>> I would apply the class to the container and differentiate the headings
>> with the "descendant selector"
>>
>> http://www.w3.org/TR/CSS21/selector....dant-selectors
>>
>> .sidebar h2 { /* headings for sidebars */--
>>
>> .content h2 { /* headings for content area */--
>>
>> <div class="sidebar">
>> <h2>This will have sidebar styling</h2>
>> <p>...</p>
>> </div>
>>
>> <div class="content">
>> <h2>This will have content styling</h2>
>> <p>Some content...</p>
>> </div>
>>
>> You do not have to put a class on every element...
>>


<you should snip my signature in replies>

> I see ... that is one approach ... I was also considering it.
>
> Using your suggested approach I get my code more organized but longer
> or not?


Not sure what you mean?

>
> So you don't define default styles in your CSS (when I mean default I
> don't mean the resulting from some Reset.css)
>


Still don't know what you mean. I only define what I which to change
from browser defaults or that is significant to my design. If it don't
matter whether or not my pages font is serif or not then I do not bother
defining it!

> A side question: How do you organize your CSS? I usually use:
>
> Typography, Layout, ...
>
> So in Layout I would have:
>
> div.Sidebar
>
> and Typography I would have:
>
> div.Sidebar h2
>
> Or you put everything together?




I organize is by the cascade. So generally the the broader more general
properties first and the more specific last.

p {
font: normal/110% "New Century Schoolbook", serif; text-indent: 3em;
--

p.shout {
font-size: x-large; font-weight: bold;
--

p#picayune {
font-size: x-small;
--

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Reply With Quote


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On


© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 09:02 PM.
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.




Inactive Reminders By Mished.co.uk