Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion CSS classes
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Matthew Browne  
View profile   Translate to Translated (View Original)
 More options Jun 25 2012, 9:41 pm
From: Matthew Browne <mbrown...@gmail.com>
Date: Mon, 25 Jun 2012 21:41:30 -0400
Local: Mon, Jun 25 2012 9:41 pm
Subject: Re: CSS classes

I think the responses so far, taken together, serve to show that it's a
question of balance, although you certainly want to /favor/ classes over
lengthy selectors. In many cases you can do without ID or deeply nested
selectors entirely, but of course there are also plenty of times when
they're helpful and make the code more concise and elegant, for example
if you have section of a page that needs to override default styling and
the CSS would most likely never need to be reused.

And the point about first-child is a good one - first-child and
last-child are very handy.

Unfortunately I think this is one area where it's particularly difficult
to give a cut and dried answer - just remember that when thinking about
all the reusable "objects" (as in the first "O" of OOCSS) on your page
you should generally be thinking in terms of classes, not complicated
overrides or rules that assume a particular page layout/template.

On 6/25/12 3:56 PM, nicolechung wrote:

> I try to reserve ID's for javascript usage and (when possible) avoid
> them for CSS styling.

> I had a smallish site where I switched my ID's (for styling) over to
> CSS classes and it did make my stylesheet smaller and easier to
> maintain. And yes, my site did end up loading a lot faster just
> because I wasn't writing overly specific styles to override IDs.

> That being said, it would be a massive job on a bigger site to switch
> existing IDs over to classes, and there would be a lot of
> troubleshooting involved. Plus if you are working on a big site with a
> big team it would just be difficult to get so many people to adjust to
> not using IDs for CSS styling.

> As far as other selectors...I can't see getting rid of pseudo
> selectors for :hover effects and there are many cases where you say,
> need to style a first-child differently from the rest of your page.

> On Monday, 25 June 2012 15:05:26 UTC-4, lkrids wrote:

>     I am a front-end developer and lately I have been reading a lot
>     about css selectors performance and maintainable css.  Together
>     all the articles seem to suggest when possible use at least one
>     class for each rule set, and the corollary that all dom nodes that
>     receive css style should have at least one class.  That means in
>     css avoid ids, tags, descendant selectors, and basically all of
>     these http://www.w3.org/TR/CSS2/selector.html#pattern-matching
>     <http://www.w3.org/TR/CSS2/selector.html#pattern-matching>.  Do
>     you agree with this?

> --
> You received this message because you are subscribed to the Google
> Groups "Object Oriented CSS" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/object-oriented-css/-/R3t654Pxe1wJ.
> To post to this group, send email to object-oriented-css@googlegroups.com.
> To unsubscribe from this group, send email to
> object-oriented-css+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/object-oriented-css?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.