2
I’m making a website as illustrated below, only I’m having a problem making the div
central. I don’t know how to do that part where the nav
and section
.
Code:
html,
body {
position: relative;
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
}
#main {
width: 100%;
height: 100%;
}
header {
width: 100%;
height: 10%;
box-sizing: border-box;
border: 1px solid black;
}
#logo {
position: absolute;
top: 0px;
left: 0px;
}
#redes {
position: absolute;
top: 0px;
right: 0px;
}
#content {
margin-top: 20px;
position: absolute;
width: 100%;
height: 80%;
border: 1px solid black;
box-sizing: border-box;
}
footer {
box-sizing: border-box;
border: 1px solid black;
position: absolute;
bottom: 0px;
width: 100%;
}
footer p {
text-align: center;
}
nav {
position: absolute;
top: 0px;
left: 0px;
border: 1px solid black;
width: 10%;
height: 100%;
}
section {
margin—left: 10%;
width: 90%;
height: 100%;
border: 1px solid black;
}
<div id="main">
<header>
<div id="logo">
<h1>Logo</h1>
</div>
<div id="redes">
<h1>Redes Sociais</h1>
</div>
</header>
<div id="content">
<nav>
<p>
<a href="/">Home</a>
</p>
<p>
<a href="/contact">Contact</a>
</p>
</nav>
<section>asad</section>
</div>
<footer>
<p>
© Copyright by
</p>
</footer>
</div>
Thank you.
I recommend not to use Absolute position to adjust layouts, this is very difficult. Already tried bootstrap?
– Guilherme Nascimento
Not yet tried but the purpose of what I’m doing is not to fit to mobile devices only on the computer
– Thepeter
I wish I knew what I was doing wrong
– Thepeter