Drupal 7 Question

tf2012
tf2012 used Ask the Experts™
on
This can't be real.  I just added a content block to my footer region in my first custom theme.  I published it and looked at the source.  Check out how the wacky selector name and classes....

<div id="block-block-3" class="block block-block contextual-links-region">
  <div class="contextual-links-wrapper contextual-links-processed"><a class="contextual-links-trigger" href="#">Configure</a><ul class="contextual-links"><li class="block-configure first last"><a href="/testsite/admin/structure/block/manage/block/3/configure?destination=node">Configure block</a></li>
</ul></div>
  <div class="box">
    <p>123.123.123</p>
<p>123 Upper Rd | City, State | ABC 123</p>
<p>©2014 Some Company Ltd.</p>
  </div>
</div>

Open in new window


Is this really how drupal renders elements?  Why the crazy long selector and class names?  Am I missing something here?  block block-block ?  Really?  Any drupal experts out there have a minute to explain it to me?

thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
I guess what I am asking is if it is normal to see selectors and classes like that
Drupal creates an excess of classes and ids to allow flexibility in styling. There is various logic around these selectors. In this case one 'block' is created because it is from the block module, the other because it is a 'block'. So if there is another block created for example by the views module you might have a class such as views-block or the user module user-block. So you could then style a user block differently to a core block module block.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial