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

Received: by 10.52.69.241 with SMTP id h17mr10837362vdu.5.1340654175517;
        Mon, 25 Jun 2012 12:56:15 -0700 (PDT)
X-BeenThere: object-oriented-css@googlegroups.com
Received: by 10.52.92.3 with SMTP id ci3ls2115325vdb.9.gmail; Mon, 25 Jun 2012
 12:56:14 -0700 (PDT)
Received: by 10.52.179.98 with SMTP id df2mr844692vdc.3.1340654174765;
        Mon, 25 Jun 2012 12:56:14 -0700 (PDT)
Date: Mon, 25 Jun 2012 12:56:14 -0700 (PDT)
From: nicolechung <nicole.ch...@gmail.com>
To: object-oriented-css@googlegroups.com
Message-Id: <293ca445-69f4-4e10-9552-339b0405480a@googlegroups.com>
In-Reply-To: <9563605e-2caf-4a61-9e0e-5b0318779037@googlegroups.com>
References: <9563605e-2caf-4a61-9e0e-5b0318779037@googlegroups.com>
Subject: Re: CSS classes
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_119_18329740.1340654174314"

------=_Part_119_18329740.1340654174314
Content-Type: multipart/alternative; 
	boundary="----=_Part_120_4704858.1340654174314"

------=_Part_120_4704858.1340654174314
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

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.  Do you agree 
> with this?
>

------=_Part_120_4704858.1340654174314
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

I try to reserve ID's for javascript usage and (when possible) avoid them f=
or CSS styling.&nbsp;<div><br></div><div>I had a smallish site where I swit=
ched my ID's (for styling) over to CSS classes and it did make my styleshee=
t 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 ID=
s.&nbsp;</div><div><br></div><div>That being said, it would be a massive jo=
b 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.</div><div><br></div><div>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 differ=
ently from the rest of your page.&nbsp;</div><div><br></div><div><br></div>=
<div><br></div><div><br><br>On Monday, 25 June 2012 15:05:26 UTC-4, lkrids =
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.=
8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><span style=3D"font-fam=
ily:arial,sans-serif">I am a front-end developer and lately I have been rea=
ding a lot about css selectors performance and maintainable css. &nbsp;Toge=
ther 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 st=
yle should have at least one class. &nbsp;That means in css avoid ids, tags=
, descendant selectors, and basically all of these&nbsp;</span><a href=3D"h=
ttp://www.w3.org/TR/CSS2/selector.html#pattern-matching" style=3D"color:rgb=
(17,85,204);font-family:arial,sans-serif" target=3D"_blank">http://www.w3.o=
rg/TR/<wbr>CSS2/selector.html#pattern-<wbr>matching</a><span style=3D"font-=
family:arial,sans-serif">. &nbsp;Do you agree with this?</span><br></blockq=
uote></div>
------=_Part_120_4704858.1340654174314--

------=_Part_119_18329740.1340654174314--