I have a SideNav which is position: absolute;
and is fill all the left side of screen and my table is on the middle of screen, but if I want to apply a margin-top:50px;
the SideNav get it too.
If I remove the position
it works but it can't fill all the left side anymore.
App.css (Main CSS file) : https://hastebin.com/fodafasidi.css
Navig.js : https://hastebin.com/uluhogetuj.xml
I don't know why it does that, thanks for help.
body{
height: 100vh;
margin: 0;
padding: 0;
background-color: #F5F5F5;
}
.App {
text-align: center;
}
.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
}
.App-header {
background-color: #222;
height: 150px;
padding: 20px;
color: white;
}
.App-title {
font-size: 1.5em;
}
.App-intro {
font-size: large;
}
table {
text-align: center;
width: 500px;
margin:auto;
margin-right: 40%;
border-color: #0585e1;
border-width: 1px;
border-style: groove;
padding: 20px 0;
background-color: #c9d4e8;
border-radius: 3px;
margin-top: 10px;
}
table input {
width: 200px;
border-color: #0585e1;
border-style: groove;
padding: 4px;
font-size: 13px;
background-color: #c9d4e8;
color: #0585e1;
margin:3px 0;
}
table td {
color: #0585e1;
}
button {
color: #0585e1;
background-color: #c9d4e8;
margin-top: 15px;
cursor: pointer;
width: 150px;
font-size: 15px;
border-color: #0585e1;
border-style: groove;
}
#navigator {
background: #354256;
color: #0585e1;
height: 100%;
position: absolute;
}
Instead of applying margin-top: 50px;
to your <body>
element, apply:
padding-top: 50px;
also, in addition to declaring position: absolute
for #navigator
, you should, ideally, provide explicit co-ordinates.
e.g.
#navigator {
position: absolute;
top: 0;
left: 0;
height: 100%;
color: #0585e1;
background-color: #354256;
}