--
You received this message because you are subscribed to the Google Groups "Object Oriented CSS" group.
To post to this group, send email to object-or...@googlegroups.com.
To unsubscribe from this group, send email to object-oriented...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-oriented-css?hl=en.
FWIW, we went with a similar approach. You don't class each <p>, but instead use a "sandbox" class (or several classes) for styling content in various ways. Erik calls them "format" classes. Same difference. Legalized location-dependent styling, I guess :).
--
You received this message because you are subscribed to the Google Groups "Object Oriented CSS" group.
To post to this group, send email to object-or...@googlegroups.com.
To unsubscribe from this group, send email to object-oriented...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-oriented-css?hl=en.
I just want to add another example for "location-dependent" styles.
What if the data is entered by users, ie: forum posts. In the main
content area of the page, you show teasers of the most recent posts.
But in the right sidebar, you show teasers of "hot" posts. Some of
the ones in the body and the sidebar could be exactly the same (if a
post is both recent and "hot"). But in the sidebar you want the
font-size to smaller.
In this case, having different HTML for body and sidebar is extra
impractical. You don't want to parse and modify the HTML or require
the users to enter their posts multiple times.
In my opinion, basic document formatting tags (which users will be
entering into the system, either by hand or with a WYSIWYG editor)
should sometimes be exceptions to passing style from module to body.
I liked the "format classes" discussed above. That way you can keep
the specificity of all your location dependent styling the same. Ie.
Rather than saying "#right-sidebar p" you would always add a module
class that does it (ex. ".smallerMod p"). It's a half-way compromise
solution.
Regards,
David.
2011/5/12 erik.f...@googlemail.com <erik.f...@googlemail.com>:
--
Blog: http://www.linguatrek.com
Product: http://www.bibliobird.com
On the other hand you would never want to do this:.myMod p{border: 1px solid red;}because p is not a node of the module object. You don't want to let any styles bleed through the body.Of course this means you end up with extra (admittedly annoying) classes in your HTML, but it is a worthwhile trade-off for the flexibility/reusability/predictability you get.Content objects are a different story because they do not have a body, so you don't need to worry about style pass-through.
I liked the "format classes" discussed above. That way you can keep
the specificity of all your location dependent styling the same. Ie.
Rather than saying "#right-sidebar p" you would always add a module
class that does it (ex. ".smallerMod p").
Maybe this makes me a bad developer, but I don't really care about
introducing a small number of presentational classes. :-)
Especially, if doing so makes the project more maintainable. Using
"#right-sidebar p" is more semantically correct but also brings a lot
of negatives along with it (ie. not reusable, increasing specificity).
Just like putting a class on every "p" which is created by site users
brings some negatives. In my opinion, pragmatic use of exceptions can
be a good thing.
Regards,
David.
--