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.
there is a rule in the css
h1, .h1, h2, .h2, h3, .h3 {
margin-bottom: 10px;
margin-top: 20px;
}
and there is an override only for the first child
.block:first-child h2.block-title {
margin-top: 0;
}
so if you put lets say two blocks next to each other in a region they will not look good because their titles will not be on the same height
one has to do add extra css to correct this
.h2.block-title {
margin-top: 0;
}
is this a bug ? by mistake ?
Comments
Comment #1
neardark CreditAttribution: neardark commentedI suspect this was done to remove extra space above the first block in a sidebar, which isn't entirely uncommon. We could fix this, but then the first block in sidebars would have extra spacing. Personally, I prefer to use a set of utility classes at the end of overrides.css that allow me to alter the margins of an element. Something like margin-hard--top { margin-top: 0; } that I add as a class to those blocks.
Comment #2
markhalliwellYes, I've been using something similar in SASS: https://gist.github.com/markcarver/e04d2775854fd24b56fb
Which would allow you to add a class like
.no-margin-top
. However, I really do not think this is the best approach. If anything, perhaps the CSS should just be changed to the following so it's limited to just the sidebar (which is, yes, what this is for):Comment #3
JurriaanRoelofs CreditAttribution: JurriaanRoelofs commented+1 for limiting the scope of this block-margin:0.
would be even safer.
Comment #4
markhalliwellComment #6
markhalliwell