2
Talk people, I’m dealing with CSS for a personal blog that I intend to create.
But I’m having trouble understanding some aspects of positioning.
Below is an initial version of the blog:
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../css/reset.css"/>
<link rel="stylesheet" href="../css/basico.css"/>
<link rel="stylesheet" href="../css/artigo.css"/>
<link rel="stylesheet" href="../fonts/anurati.otf"/>
</head>
<body>
<header>
<h1 class="titulo-pagina">Blog</h1>
<img class="icone-blog" src="../imagens/icons/icone-header.ico" alt="ícone do blog"/>
</header>
<main>
<div class="texto">
<div class="menu-lateral">
<ul>
<li><a class="link" alt="capítulo 1">Capitulo I</a></li>
<li><a class="link" alt="capítulo 2">Capitulo II</a></li>
<li><a class="link" alt="capítulo 3">Capitulo III</a></li>
<li><a class="link" alt="Imagens">Imagens</a></li>
<li><a class="link" alt="referências">Referencias</a></li>
<ul>
</div>
<div class='artigo'>
<h1 class="titulo-artigo">Título do texto</h1>
</div>
</div>
</main>
<script src="../js/menu-lateral.js"></script>
</body>
CSS code
header{
background-color: #1768AC;
box-sizing: border-box;
width:100%;
height: 70px;
position:fixed;
top:0;
left:0;
display:flex;
align-items:center;
justify-content: space-between;
}
main{
margin-top:70px;
}
Below is a simple image of how it’s getting:
I tried to replace the header height of:
{
height:70px;
}
for
{
height: 10%;
}
and in main, I changed the margin-top from 70 px to 10%.
When inspecting the body page, it is not filling the whole page, and is with a header spacing (image below).
Why does this happen? How can I solve?
Pq you have changed the header height if everything looks right in the first print?
– Sam
You’d also have to put all the CSS in the question so we can play the code and parse.
– Sam
In fact, I made the option that was going wrong first and so I tried to solve it. However I would like to understand why I was making a mistake.
– André Machoski