I tried to remove padding and margin in my CSS code but it isn't working. Idk what to do because I started CSS programming 3 days ago, also i've already watched course for CSS.
I tried use * tag to accept margin and padding to all code but it didn't work.
* {
margin: -0px;
padding: 0px;
}
body {
height: 2000px;
}
#side aside a {
position: absolute;
text-decoration: none;
color: white;
font-size: 16px;
padding: 20px;
background: grey;
width: 10%;
height: 3%;
}
#fir {
top: 30px;
}
#sec {
top: 90px;
}
#thi {
top: 150px;
}
#for {
top: 210px;
}
<div id="side">
<aside>
<a href="" id="fir">Главная</a>
<a href="" id="sec">О нас</a>
<a href="mailto:[email protected]" id="thi">Наша почта</a>
<a href="" id="for">Контакты</a>
</aside>
</div>
The problem is that you're using:
position:absolute;and padding. You should remove the padding and usedisplay:flexinstead. When display is set to flex, it creates a flex container, allowing your contents to be displayed next to/above each other.Replace your css with this:
If you want to remove all padding whatsoever, including inside your containers, then replace your css with this: