The spaces can be due to a variety of reasons. In some cases it’s baked into core WP, sometimes it’s the theme. In the case of the wild flowers featured image, the spacing is from the image itself, it has sizable transparent borders around the visible image. If you want to reduce the spacing, it’s best to edit the source image.
Use your browser’s element inspector tool to see what CSS spacing is being applied. The tool will also show you which file the applicable rules are coming from. The file’s path will tell you whether it’s theme or WP core sourced.
You can always add additional CSS to override any theme or core rules you are unhappy with.
Thread Starter
cambob
(@cambob)
Thanks for the reply. Ive pretty much tried everything from line heights to setting all paddings and margins to 0. Spacers, grouping, paragaraphs instead of headings, columns instead of galleries, custom css ect. My first example wasnt the greatest I never realized i placed a png with space built into it.
This example here shows the heading with a big space below it before there is an image. The bottom of the heading has padding and margin set to 0. The image below it has padding and margin top set to 0. Yet there is a big gap between them. Inspecting the two elements doesnt tell me anything other than confirm the padding is set to 0. The heading has a long range of classes but trying to track them down and inspect every one of them would be tedious and probably fruitless. Unfortunately it seems most of the spaces are hard baked into the core files.
-
This reply was modified 1 month ago by
cambob.
The page’s main title (actually a <p> element that’s after the <H2> element which isn’t visible) has a standard bottom margin of 2rem. You may have set H2 margin to 0, but not the paragraph element that constitutes the visible title; it has a default bottom margin that’s necessary for normal paragraphs. Either convert this specific <p> to a visible <H?>, or override this specific <p> element’s default styling with an element style.
The <figure> element containing the image has an element style top margin of 80px. Similarly, you probably set the <img> tag’s margin to 0, but did not address the containing figure element.
The way the block editor works can make it difficult to ensure you’re setting properties of the correct element. Elements are often nested and you may need to back out of where you are in order to access the desired block settings.