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

neardark’s picture

I 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.

markhalliwell’s picture

Yes, 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):

aside .block:first-child h2.block-title {
    margin-top: 0;
}
JurriaanRoelofs’s picture

+1 for limiting the scope of this block-margin:0.

.region-sidebar-second .block:first-child h2.block-title,
.region-sidebar-first .block:first-child h2.block-title {
    margin-top: 0;
}

would be even safer.

markhalliwell’s picture

Title: h2.block-title compatibility » Too aggressive h2.block-title margin-top override

markhalliwell’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.