No foaming so far today, DeathShadow?!
Dresden just can’t type, but you burn entire villages down - for no apparent reason - on some days…
(That’d make a sweet Sig Line…) :devil:
It’s in the HTML spec that you can have as many classes as you like on an element. As class and ID are separate attributes, they do not interfere with each-other EXCEPT:
It’s in the CSS spec that anything declared in an ID trumps a class – so obviously you can combine them… but beware if you try to set a value with a class that’s already decalred in the ID, it won’t take.
Right.
Also be aware that certain combinations CSS side of classes…
#boxFeatured.box (notice the lack of space between them – means both must be present on the element) will not work in certain older versions of IE and FF. (in FF it’s usually a regression error).
I was going to use them separately, but I follow you.
It’s how the {massive string of expletives omitted} over at turdpress can vomit up idiotic code like this:
<li id=“menu-item-781” class=“menu-item menu-item-type-post_type menu-item-object-page menu-item-781”>
Which just makes me want to backhand somebody…
True.
All that taken into consideration, bloating out the uncached markup instead of the CSS is not a great approach to coding from an efficiency or bandwidth standpoint.
Okay.
To do what your saying
DeathShadow made the “YOUR” mistake?! (Must be a post-Thanksgiving cold!)
I’d be going:
#boxFeatured,
#boxEvents,
#boxFactoids,
#boxTip {
margin: 20px 0;
border: 1px solid #AAA;
}
#boxEvents {
font-size: 2em;
}
#boxFactoids {
font-size: 3em;
}
#boxTip {
font-size: 4em;
}
That way you aren’t blowing bandwidth by saying class=“box” on every single one of them in the markup. Ends up about the same amount of code in the long run, but uses less bandwidth if this CSS is being used on more than one page.
I was thinking about that approach last night as well.
I suppose it still accomplishes my “Write once, re-use many times”, except if you had 100 different “boxes” that would get sorta unwieldy…
I guess your key point is to “Leave the HTML alone!” (or as simple as possible).
Always remember the reasons to use CSS in the first place – simpler HTML, semantic HTML, reduction of bandwidth by caching appearance across pages, speeding subsequent page-loads by pre-caching appearance, and ability to restyle the page without major (or if well crafted… any) changes to the markup.
Fair enough.
But then what do you think about this thread of mine…
Seeking Polymorphic CSS Class
I’m not trying to go WordPress on anyone, but I am trying to simplify my code and make things more manageable.
side note, there’s no reason to ever say font-size:1em unless you’re overriding a previous declaration
That was just a silly example.
Debbie