I'm theming using the Omega HTML5 starterkit theme on Drupal 7, and I want to add CSS just to the main content region in nodes but not to the comments.

How do I do that? What is the class (or ID) for that?

  • Why can't you just use Firebug and look for yourself? – Chapabu Aug 31 '12 at 13:11

In my own Omega subtheme, which is quite standard, page content with comments has this structure (closing tags omitted for brevity):

<article ... class="... node ...">
  <div class="content clearfix">
    <div class="field field-name-body ...">   (node body)
    <div class="field field-name-... ...">    (another node field I'm displaying)
  <div class="clearfix">     
    <nav class="links node-links clearfix">
    <div id="comments" class="comment-wrapper">

So a CSS selector of:

node > content

would get you all the fields in the content, but not the comments. Or if you just want to style the body, you could choose it specifically.

Note that the content class is used a number of different places in a page. Alternatively you might want to set up some default CSS for most of the node and style the #comments or .comment-wrapper separately.

This is not profound: I just poked around with Firebug to figure it out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.