Skip to main content
Topic: Overly specific CSS (teh bloatness). (Read 6487 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Overly specific CSS (teh bloatness).

Just keep an eye out for stuff like the following:

Code: [Select]
table.table_grid
table.table_list
table.table_padding
div.cat_bar
div.title_bar

Point is that all of those table classes are tables. Calling them by class is quite sufficient, and better for performance, and easier for coders. Same goes for the cat_bar and title_bar classes. They are all divs, so the tag name isn't needed or wanted for CSS.

The only time a tag name is needed with a class in CSS is if you have two or more different tags sharing the same class name. Ideally, that shouldn't happen, but if/when it does (meh) it can be dealt with on a case by case basis. Better would be to call something like .whatever>thingy and .something_else>thingy rather than using tag names.

Tag names are generally good for javascript, but crap for CSS. :)

There are probably a few other classes like this lurking around the place. I'll mention them if I find them.

PS: And id's should never call tag names in CSS either. If that becomes necessary, best to change the id name.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Overly specific CSS (teh bloatness).

Reply #1

Actually, while I've got a thread about CSS........................

What is really needed at the moment is for people to stop playing with new theme ideas, and get the default CSS (whatever that is going to be) into shape.

At the moment it's a mess. It really needs all the declarations for classes/whatever collated so they are all in logical places, rather than having WIP stuff strewn throughout the file. That leads to trouble hunting down conflicts between where you'd expect something to be declared, and all the places it is actually declared at the moment.

This applies particualrly to index.css and admin.css. The other files should be pretty good, but index and admin need serious rationalising before you'll have a fit base for custom work (or indeed, any further work on default).

Which brings me to admin. I thnk it's generally agreed that the cleaner admin look inherited from 2.1 Alpha is a good thing. It was header bar madness before. Admin.css is currently a prime example of stuff being called in too many places, and in too complex a fashion. Given that the cleaner look is desirable in admin, it would make sense to revamp the markup rather than binding yourself to keeping all the 2.0.x markup, which is what it has at the moment.

This would result in simpler markup and in simpler css.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Overly specific CSS (teh bloatness).

Reply #2

Can't fault that. :) its exactly my thinking with Protendo as well, making admin css/markup less specific. And why I use a simple CSS grid to build admin pages instead of the many floats etc.