I've encountered several times this issue and I would like to know why the browsers interpret the header
inside the p
tag. This breaks the layout as the elements have a margin applied to it, therefore it always needs some adjustments.
If I inspect the element I can see the following:
The p
tag includes the header as if it was inside the p
tag.
If I select the header with the inspector I get the following:
The header is only selected. My layout breaks as the margin of the paragraph is making more space above the header. Why does this happen?????
Here below you can see my html which is very simple and clear:
<section class="content">
<h1>Meet Sophie, our unique vision for design speakers</h1>
<p>Are you looking for high-performance design speakers that can provide a truly mesmerizing sound experience? If so, B.A.S. has the answer. We believe that speakers should create a comprehensive atmosphere. That’s why we design speakers that have the power to capture the imagination – both aurally and visually.
</p>
<p>Sophie is our first innovation, a set of thin-bodied design speakers with voluptuous curves and a remarkably strong voice. Explore our versatile sets and meet the beauty of sound in person.
</p>
<h1>The DD set: design speakers for studios and events</h1>
<p>Ever the optimal choice for studios, events and large spaces, our Sophie DD set consists of two perfectly balanced, artistic design speakers paired with two powerful subwoofers. Whether you’re mixing, recording, performing or simply listening, these design speakers will always leave a lasting impression with any audience that hears and sees them.
<br>
[Explore the possibilities of our professional design speakers]
</p>
<h1>The DS-set: design speakers for powerful, centralized sound</h1>
<p>Dedicated spaces deserve dedicated sound. With the DS set of Sophie design speakers, you’ll be able to create a comprehensive experience in a wide range of specific scenarios – from listening rooms and media rooms to professional presentations, the twin Sophie design speakers and their single subwoofer companion will easily create the perfect soundscape.
<br>
[Create beautiful soundscapes with our versatile design speakers]
</p>
</section>
` tag and the `
` tag and says that it is a `p` tag. The question is about why the `h1` is included in the `p` when it doesn't appear to. It could be to do with margins if the p had a very large top margin and some kind of positioning that meant the header could be placed over the top margin of the p... But its not just to do with collapsing margins.
– Chris Nov 28 '13 at 20:48