Ramy Nabiel Ramy Nabiel - 2 months ago 5
CSS Question

CSS Put Div Tag at top of page without space

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>

AME AME
Answer

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