Header problem, padding-top is changing header height

Asked

Viewed 26 times

-1

*{

margin: 0;

padding: 0;}

.header{

background-color: #212343;  
width: 100%;
height: 70px;
text-align: center;
word-spacing: 15px;
font-size: 20px;
padding-top: 15px;

}

.header > to{

color: white;

}

.banner{

width: 100%;
height: 555px;
background-image: url('../imagens/aviao.png');
background-size: cover;
background-repeat: no-repeat;

}

1 answer

0

Padding changes the height yes, in short padding is an internal margin, so add the height.

inserir a descrição da imagem aqui

If you want to add a "distance" outside the box, you should use the margin, which basically does the same, but outside the element.

  • 2

    Padding changes the height yes, in short padding is an internal margin, so add the height. - This is not correct, it depends on the box model used, which is regulated by the property box-sizing: https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing - In the case of your screenshot you are specifically talking about the element you are using border-box, therefore the solid line indicated in the inspector

Browser other questions tagged

You are not signed in. Login or sign up in order to post.