I have the html5 element in my project and given it a padding. Firefox and Chrome show the padding correctly, but unfortunately Opera, Safari and IE don't.
Do you have any experience with this issue and know how to solve it?
It is not happening due to my reset.css, and I was able to reproduce the error in a simple fiddle. Just check it in the named browsers to see the difference.
And here is the example code.
HTML:
<section class="wrapper">gets padding everywhere</section>
<main class="wrapper">gets no padding in the mentioned Browsers</main>
<section class="wrapper">gets padding everywhere</section>
CSS:
.wrapper {
padding: 8em 0;
}
Thank you!
Safari/IE11/Opera
.Edit
- ah, as mentioned below, some browsers don't treat it as a block level element.main { display:block }
will fix this. – Hisakohisbe<main>
element was a late addition to HTML5 (it was only added to the spec in the middle of 2013), so not all browsers will support it. You need to provide it with a default CSS stylesheet of{display:block;}
. – Anoxia