Trying to create a login page for my capstone project and for osme reason the form I created isnt taking up the fullscreen
Made a form for a login page with columns styled in Bootstrap, expected it to fill up the screen but for some reason just takes up about half with the other half being white.
body {
font-family: "Lato", sans-serif;
}
.main-head{
height: 150px;
background: #FFF;
}
.sidenav {
height: 100%;
background-color: #000;
overflow-x: hidden;
padding-top: 20px;
}
.main {
padding: 0px 10px;
}
@media screen and (max-height: 450px) {
.sidenav {padding-top: 15px;}
}
@media screen and (max-width: 450px) {
.login-form{
margin-top: 10%;
}
.register-form{
margin-top: 10%;
}
}
@media screen and (min-width: 768px){
.main{
margin-left: 40%;
}
.sidenav{
width: 40%;
position: fixed;
z-index: 1;
top: 0;
left: 0;
}
.login-form{
margin-top: 80%;
}
.register-form{
margin-top: 20%;
}
}
.login-main-text{
margin-top: 20%;
padding: 60px;
color: #fff;
}
.login-main-text h2{
font-weight: 300;
}
.btn-black{
background-color: #000 !important;
color: #fff;
}
<!DOCTYPE HTML>
<html lang="en">
<head>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="sitestyle.css" rel="stylesheet" type="text/css">
<title>Excell Visualizer</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="sidenav">
<div class="login-main-text">
<h2>Chartcel <br> Login Page </h2>
<p>Login or register from here to upload your desired spreadsheet.</p>
</div>
<div class="main">
<div class="col-md-6 col-sm-12">
<div class="login-form">
<form>
<div class="form-group">
<label>Username </label>
<input type="text" class="form-control" placeholder="Username">
</div>
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control" placeholder="Password">
</div>
<button type="submit" class="btn btn-black">Login</button>
<button type="submit" class="btn btn-secondary"> Register</button>
</form>
</div>
</div>
</div>
Screenshot of problem:
enter image description here
2
Answers
You really need to edit your question to turn your code into a snippet which demonstrates the problem. I have turned your code into a snippet here in my answer, but I can’t see the problem.
You’re having this issue because the .sidenav class has a width of 40%
so the other 60% is just whitespace.
just set the width of .sidenav to 100% and remove the margin-left: 40% property from the .main class.
I also noticed when I did this that your elements aren’t centering properly so I’ve added the following CSS rules to fix this.