Skip to:

Re: Theme designers: Use CSS classes, not IDs.

Using classes for everything is pretty sloppy. When start hacking up the bbpress theme and come across an ID I know exactly whether or not that element is going to be repeated. When I work with a design that has strickly class based selectors I go crazy.

Something like “class=header” is completely insane. There really should only be one header inside the site and you use an ID to signify that elements usage.

For example when I take a look at /bb-templates/font-page.php and see <table id=”latest”> I already have a good idea of what all the code contained inside that <table> tag will be.

Also if my page gets larger I can put “jump links” to those sections and help my users navigate my site.

There are other properties of ID tags that do fancy stuff with javascript but I’m not quite sure what they are.

Skip to toolbar