can anyone explain why putting margins in each tag still leaves a space inbetween the article and header tag but when I use the * selector the space gets removed. I don't necessarily want all elements with a margin of zero. I would rather set each one I want to 0.
snippet 1 below leaves a space in between header and article tag
body
{
background-color: yellow;
margin: 0 0 0 0;
}
#header
{
background-color: blue ;
margin: 0 0 0 0;
width: 100%;
height: 40px;
border: 3px solid black;
}
#article
{
background-color: red;
margin: 0 0 0 0;
}
#search {
background-color: #a6dbed;
height: 500px;
margin: 0 0 0 0;
}
#mostdesired
{
background-color: #c7d1d6;
height: 200px;
margin: 0 0 0 0;
}
when I add this snippet below all spaces in between the article and header tag get removed, which is what I want, but I don't necessarily want 0 margin for all elements
*{
margin: 0
}
Here is the html
<body>
<header id="header">@*<h1>Welcome</h1>*@</header>
<article id="article">
<section id="search"><h2>this is the search</h2>@RenderBody()</section>
<section id="mostdesired"><h2>This is the most section</h2></section>
</article>
</body>