Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS - A white gap between my HTML and BODY

I'm trying to use HTML5 Boilerplate + Normalize.css for my current project, and I faced the follow issue.

There seems to be a gap between my HTML tag and my BODY tag. I've tried to figure out what's the cause of this, but failed after many tries.

I must have missed something here or there.

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<title>Ridanis | Web Design &amp; Web Development</title>

<meta name="description" content="">
<meta name="viewport" content="width=device-width">

<link rel="stylesheet" href="css/normalize.min.css">
<link rel="stylesheet" href="css/main.css">

<script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
</head>
<body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->

<!-- Wrapper / Start -->
<div class="wrapper">
<h1>Hello World!</h1>
</div>
<!-- Wrapper / End -->

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.9.1.min.js"><\/script>')</script>

<script src="js/main.js"></script>
</body>
</html>

Here is a fiddle: http://jsfiddle.net/C7gbC/

Thanks in advance.

like image 641
Khaled Avatar asked Jan 14 '23 14:01

Khaled


1 Answers

normalize.css inserts a default margin declaration on h1 elements based on browser defaults for consistency:

h1 {
    font-size: 2em;
    margin: 0.67em 0;
}

If you zero it out manually (either in your main stylesheet or by modifying normalize.css directly), the gap will disappear:

h1 {
    margin: 0;
}
like image 66
BoltClock Avatar answered Jan 19 '23 12:01

BoltClock