I want to put a div tag with id "wrapper" at top of page, but the problem is
that there is a white space between the div tag "wrapper is yellow color"
and the top of page.
My question is how can I remove the white space between the div tag and the top of page?
Here is my code
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
body {
margin: 0;
padding:0;
}
#wrapper {
width:1000px;
text-align:center;
margin-right:auto;
margin-left:auto;
margin-top:0px;
background-color: yellow;
padding:0px;
}
</style>
</head>
<body>
<div id="wrapper">
Testing
</div>
</body>
</html>
Try this in the css code:
{
position:absolute;
top:0px;
}
You can use the right
or left
to make a space between the div and the corner
The problem is: https://stackoverflow.com/a/5910170/2670516
Try replace all your code by:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<style type="text/css">
body {
margin: 0;
padding:0;
}
#wrapper {
width:1000px;
text-align:center;
margin-right:auto;
margin-left:auto;
margin-top:0px;
background-color: yellow;
padding:0px;
}
</style>
</head>
<body>
<div id="wrapper">
Testing
</div>
</body>
</html>
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