Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Apart from the obvious convenience when theming, are there any technical or performance advantages for using block_class over using css to target individual block IDs
Just curious ???
Comments
Comment #1
Soundvessel CreditAttribution: Soundvessel commentedWell from recent experience working with local and multiple staging servers we have had some blocks not have the same IDs between servers. This would allow us to target theming without worrying about these sync issues.
Comment #2
MrPaulDriver CreditAttribution: MrPaulDriver commentedinteresting, I can see the benefits there
Comment #3
autopoietic CreditAttribution: autopoietic commentedAlso I would suggest that if using a grid based theme a configurable block class allows the layout properties of the block to be taken care of by layout classes like 'span5' etc in bootstrap.
Comment #4
feuillet CreditAttribution: feuillet commentedAnd one big advantage is the one CSS classes have in general: you can use them multiple times within the same html document.
Just create a new block, put in your desired class and voila, theming done.
Otherwise you would have to edit the css to match the new CSS ID...
Comment #5
MrPaulDriver CreditAttribution: MrPaulDriver commentedI've been using this for a few weeks now and it is a big time saver. I'll never go back to targeting individual block IDs. Thanks everyone for the input.
Comment #6
rennevat CreditAttribution: rennevat commentedWanted to add that this is one our essential Drupal modules. It has also replaced modules that we previously attempted to use to enforce mobile or screen block display. Now we just add the class that defines whether it should be displayed based on screen size and the blocks render flawlessly. A "must have" module.
Comment #7
renatog#3 really make sense.
Thank you very much, guys. Very useful.
Comment #8
renatogIf anyone has any question please comment okay?!
Thank you very much, people.
Regards.