I'm keen to use Paul Irish's HTML5 boilerplate but I've encountered a css problem.
I want the header to be flush at the top of the page but I can't the container div adds a gap that I'm unable to get rid of.
I think this has something to do with the clearfix for the footer. I've tried experimenting with different padding sizes for the footer and container div but to no avail.
This is the html code:
<header>
<p> header content </p>
</header>
<div id="main" role="main">
</div>
<footer>
<p> footer content </p>
</footer>
My custom CSS:
#container {
background-color:orange;
padding:1px; /* can't be zero */
margin:0;
}
footer {
margin: 1px 0;
}
body {
width:960px;
margin:0 auto;
background:blue;
padding:0;
}
Just set margin:0 in your h1 tag. Save this answer. Show activity on this post.
On the Tools menu, click Options. Click the View tab and then click to select or clear the White space between pages check box.
HTML. Approach 2: We can also eliminate the extra space using the margin-top property. The margin-top property sets the top margin of an element. When we use margin-top we have to apply it on the tag, such that we have to eliminate extra space above it.
There are two methods for removal of space between two divs or two elements. First one is, assign the font size of the parent of the inline block element to 0px and then assign the proper font-size to the inline block element. and Second is, Make the display of the parent element to flex.
@techjacker; may be you have to write like this:
header{display:block}
p{margin:0;padding:0}
This sometimes help:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With