My webpage retrieves content from a WYSIWYG editor, and I'm looking to apply fixed margins/padding similar to the "h2" element, which always has a margin-bottom of 20px, and paragraphs have a margin-top of 10px. The issue arises when a "p" tag immediately follows an "h2" element, causing the space between them to increase to 30px due to the combined margins.
Is it possible to consistently limit this spacing to 20px? Can we somehow override the child element's margin-top if the parent already has a margin-bottom?
I attempted using h2+p {margin-bottom: 20px;} to address this, but the challenge lies in the dynamic nature of the content, which can contain various HTML elements such as h3, div, span, and more.
Any suggestions for resolving this issue would be greatly appreciated.