I am a newbie to html/css. I wanted to remove default browser margin in body part. I have added margin zero to the body. It's working fine for left and right sections, but not working for top margin areas. Please find the attached screenshot. I know this is a basic one..but I am new to this..Margin added for body
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Box model</title>
<style>
html,
body {
margin: 0 !important;
padding: 0 !important;
}
p,
h1,
ul {
border: 1px solid rebeccapurple;
}
</style>
</head>
<body>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Eos aliquid blanditiis qui nisi quae recusandae possimus ipsam esse voluptatibus necessitatibus, dolorem provident omnis aperiam non quis! Blanditiis, eligendi. Vitae, sunt?
</p>
<h1>this is test</h1>
<ul>
<li>hi</li>
<li>test val</li>
</ul>
</body>
</html>
I tried on adding margin to the body section and it worked fine for right and left of the box. But on top its not working fine.I tried no. of solutions but didn't work as expected.