I'm puzzled as to why the margin-bottom property in the main h2 element isn't affecting its "::after" element. Both are defined as block elements, so one margin should provide enough space between them. Even though the "h2::after" element has 0 margin on top and bottom, I believe that because of the bottom margin of h2, there should be a 40px distance between them. However, they seem to stick together.
<html lang='en>'>
<body>
<h2>Main h2 heading</h2>
<style>
h2 {
content: "main h2";
font-size: 180%;
margin-bottom: 40px;
word-spacing: 2px;
text-align: center;
color: #000;
}
h2::after {
display: block;
background-color: #4cd137;
height: 5px;
width: 250px;
content: " ";
margin: 0 auto;
}
</style>
</body>