Select and input form boxes won't line up using flex - html

On my form I have title, first name and last name on the top line. I am using flex to give the title 20% width and the first and last name 80% between them. Firstly, the title box isn't ever fully in line with the first and last names boxes, it is very minimally taller. Secondly, when my validation error messages show the title box completely moves out of place.
I have tried to research the different styling rules of select boxes but can't seem to find anything that would help. I could wrap all three boxes in one container but then I would have to give them all equal widths?
This is what happens when I submit the select box moves out of place:
h2 {
background: linear-gradient(to bottom right, #1d71b8 0%, #34a2c3 100%);
color: white;
padding: 1rem;
width: calc(100% + 3rem);
margin: 0;
font-size: 1.3rem;
text-align: center;
box-sizing: border-box;
}
form {
background-color: white;
box-shadow: 0 4px 6px rgb(0 0 0 /15%);
box-sizing: border-box;
width: 75%;
overflow: hidden;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
border-radius: 10px;
}
.information {
padding: 0 2rem 0 2rem;
width: 100%;
box-sizing: border-box;
}
.form-title {
display: flex;
flex-wrap: wrap;
width: 100%;
}
.form-title label {
margin-top: 1rem;
color: #454545;
width: calc(50% - 1rem);
}
.form-title span {
display: inline-block;
margin-top: 0.5rem;
font-size: 1rem;
}
.form-title input {
width: 100%;
border: 1px solid #cccccc;
margin: 0.2em 0 0;
padding: 0.7em 1em;
box-sizing: border-box;
font-family: "Open Sans", sans-serif;
}
.name {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
}
.titles {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 20%;
}
.titles select {
border: 1px solid #cccccc;
appearance: none;
padding: 0;
}
.titles label {
width: 100%;
margin: 0;
display: flex;
align-items: end;
}
.titles input {
width: 100%;
}
.first-last {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 80%;
}
.first-last label {
width: calc(50% - 1rem);
}
<form method="post" action="/Submit.php" id="mailingListForm">
<div class="form-title">
<h2>Form</h2>
</div>
<div class="information">
<div class="name">
<div class="titles">
<label for="title">Title</label>
<select id="title" name="title">
<option value="Mr">Mr</option>
<option value="Miss">Miss</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="Dr">Dr</option>
<option value="Other">Other</option>
</select>
</div>
<div class="first-last">
<label for="firstname">
<span>First Name</span>
<input type="text" name="firstName" id="firstname">
<span>First name is required</span>
</label>
<label for="lastname">
<span>Last Name</span>
<input type="text" name="lastName" id="lastname">
<span>Last name is required</span>
</label>
</div>
</div>
</div>

Please look into the following snippet. You need to style .titles class with the given below properties:
.titles {
display: flex;
flex-direction: column;
justify-content: flex-start;
width: 20%;
align-items: flex-start;
}
Hopefully, This solves your problem.
h2 {
background: linear-gradient(to bottom right, #1d71b8 0%, #34a2c3 100%);
color: white;
padding: 1rem;
width: calc(100% + 3rem);
margin: 0;
font-size: 1.3rem;
text-align: center;
box-sizing: border-box;
}
form {
background-color: white;
box-shadow: 0 4px 6px rgb(0 0 0 /15%);
box-sizing: border-box;
width: 75%;
overflow: hidden;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: flex-start;
border-radius: 10px;
}
.information {
padding: 0 2rem 0 2rem;
width: 100%;
box-sizing: border-box;
}
.form-title {
display: flex;
flex-wrap: wrap;
width: 100%;
}
.form-title label {
margin-top: 1rem;
color: #454545;
width: calc(50% - 1rem);
}
.form-title span {
display: inline-block;
margin-top: 0.5rem;
font-size: 1rem;
}
.form-title input {
width: 100%;
border: 1px solid #cccccc;
margin: 0.2em 0 0;
padding: 0.7em 1em;
box-sizing: border-box;
font-family: "Open Sans", sans-serif;
}
.name {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
}
.titles {
display: flex;
flex-direction: column;
justify-content: flex-start;
width: 20%;
align-items: flex-start;
}
.titles select {
border: 1px solid #cccccc;
appearance: none;
padding: 0;
}
.titles label {
width: 100%;
margin: 0;
display: flex;
align-items: end;
}
.titles input {
width: 100%;
}
.first-last {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 80%;
}
.first-last label {
width: calc(50% - 1rem);
}
<form method="post" action="/Submit.php" id="mailingListForm">
<div class="form-title">
<h2>Form</h2>
</div>
<div class="information">
<div class="name">
<div class="titles">
<label for="title">Title</label>
<select id="title" name="title">
<option value="Mr">Mr</option>
<option value="Miss">Miss</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="Dr">Dr</option>
<option value="Other">Other</option>
</select>
</div>
<div class="first-last">
<label for="firstname">
<span>First Name</span>
<input type="text" name="firstName" id="firstname">
<span>First name is required</span>
</label>
<label for="lastname">
<span>Last Name</span>
<input type="text" name="lastName" id="lastname">
<span>Last name is required</span>
</label>
</div>
</div>
</div>

You try adding some margin-bottom to it so it moves up on its own.

Related

How can align my text from center to left?

I am designing a simple signup form using Html and CSS. I just want to " already have an account ? Log in" text to left till the border of skyblue border, butI am unable to do that.
But I am getting result
Here is my html code
<div class="register-bg">
<div class="register-container">
<form>
<label for="email"><b>Email</b></label>
<input
type="text"
placeholder="Enter Email"
name="email"
required=""
/>
<label for="password"><b>Password</b></label>
<input
type="password"
placeholder="Enter Password"
name="password"
required=""
/>
<button type="submit" class="signup">Sign Up</button>
<Link>
<h1 class="register-login">
alredy have an account ? Log in
</h1>
</Link>
</form>
</div>
</div>
Here is my css code
.register-bg{
height: 100vh;
background-size: cover;
width: 100%;
background-image: url(../public/images/bg.jpg);
}
.register-container{
margin-top: 100px;
display: flex;
flex-wrap: wrap;
flex-direction: row;
width: 70%;
margin-left:27rem;
background: rgb(53, 105, 46);
align-items: center;
justify-content: center;
padding: 50px 0;
}
.register-container > form{
background:skyblue;
display: flex;
flex-wrap: wrap;
flex-direction: column;
width: 70%;
justify-content: center;
align-items: center;
}
.register-container input{
width: 80%;
font-size: 15px;
padding: 15px;
margin: 5px 0 22px 0;
display: inline-block;
text-align: center;
border: none;
background: #f1f1f1;
}
.register-login {
color: black;
font-size: 15px;
}
.signup{
align-items: center;
font-size: 14px;
font-weight: bold;
background-color: rgb(10, 119, 13);
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
opacity: 0.9;
}
Just add this to your CSS:
.register-login {
align-self: flex-start;
}
Wrap your <Link> in a div container
<div class="login-text-container">
<Link>
<h1 class="register-login">
alredy have an account ? Log in
</h1>
</Link>
</div>
Wet its width to 100%
.login-text-container {
width: 100%;
}
Full code:
.register-bg {
height: 100vh;
background-size: cover;
width: 100%;
background-image: url(../public/images/bg.jpg);
}
.register-container {
margin-top: 100px;
display: flex;
flex-wrap: wrap;
flex-direction: row;
width: 70%;
margin-left: 27rem;
background: rgb(53, 105, 46);
align-items: center;
justify-content: center;
padding: 50px 0;
}
.register-container>form {
background: skyblue;
display: flex;
flex-wrap: wrap;
flex-direction: column;
width: 70%;
justify-content: center;
align-items: center;
}
.register-container input {
width: 80%;
font-size: 15px;
padding: 15px;
margin: 5px 0 22px 0;
display: inline-block;
text-align: center;
border: none;
background: #f1f1f1;
}
.register-login {
color: black;
font-size: 15px;
}
.signup {
align-items: center;
font-size: 14px;
font-weight: bold;
background-color: rgb(10, 119, 13);
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
opacity: 0.9;
}
.login-text-container {
width: 100%;
}
<div class="register-bg">
<div class="register-container">
<form>
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="email" required="" />
<label for="password"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="password" required="" />
<button type="submit" class="signup">Sign Up</button>
<div class="login-text-container">
<Link>
<h1 class="register-login">
alredy have an account ? Log in
</h1>
</Link>
</div>
</form>
</div>
</div>
add the following code, edit it and you are good to go :)
CSS:
.login-button {
display: block;
padding: 100%;
align-items: left;
}
HTML:
<div class='login-button'>
<h1 class="register-login">
alredy have an account ? Log in
</h1>
</div>

Select and input boxes on HTML form unequal heights (CSS/Sass) - input/select style rules

I am trying to get my select box to be equal in height to the first name and last name input boxes with equally spaced labels on both. When i add padding or margin to the label it increases the size of the select box too so i can't get them to equal heights? I'm not sure if i'm missing styling rules that i'm not familiar with for the select input.
<div class="form">
<form>
<div class="information">
<div class="name">
<div class="titles">
<label for="title">Title</label>
<select id="title" name="title">
<option value="Mr">Mr</option>
<option value="Miss">Miss</option>
<option value="Miss">Mrs</option>
<option value="Miss">Dr</option>
</select>
</div>
<div class="first-last">
<label for="first-name">
<span>First Name</span>
<input type="text" name="first-name" id="first-name">
</label>
<label for="last-name">
<span>Last Name</span>
<input type="text" name="last-name" id="last-name">
</label>
</div>
</div>
form {
background-color: white;
box-shadow: 0 4px 6px rgb(0 0 0 /15%);
box-sizing: border-box;
width: 75%;
overflow: hidden;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
border-radius: 10px;
.form-title {
display: flex;
flex-wrap: wrap;
width: 100%;
}
.information {
padding: 0 2rem 0 2rem;
width: 100%;
box-sizing: border-box;
label {
margin-top: 1rem;
color: #454545;
width: calc(50% - 1rem);
span {
display: inline-block;
margin-top: 0.5rem;
font-size: 1rem;
}
input {
width: 100%;
border: 1px solid #cccccc;
margin: 0.2em 0 0;
padding: 0.7em 1em;
box-sizing: border-box;
font-family: "Open Sans", sans-serif;
}
}
.name {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
.titles {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 20%;
select {
border: 1px solid #cccccc;
}
label {
width: 100%;
margin: 0;
display: flex;
align-items: end;
input {
width: 100%;
}
}
}
.first-last {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 80%;
label {
width: calc(50% - 1rem);
input {
}
}
}
}
}
}
Try to use min-height in your css
input {
min-height:30px //Set your desired height
width: 100%;
border: 1px solid #cccccc;
margin: 0.2em 0 0;
padding: 0.7em 1em;
box-sizing: border-box;
font-family: "Open Sans", sans-serif;
}
Do it to your name input as well.

HTML form have a weird offset

My HTML form looks so ugly because in last name it has right offset(I don't want that)
image showing what I mean and I could not find any problems,
maybe someone can help? Below I added HTML and SCSS code.
Thank you for help.
.contact{
display: flex;
justify-content: center;
align-items: center;
height: 60vh;
width: 100%;
}
#mixin contact_form_input_style {
width: 100%;
background-color: $img-wrapper-bg-color;
border: none;
border-radius: 10px;
height: 50px;
padding: 10px;
margin: 10px;
}
.contact-form{
display: flex;
width: 60%;
justify-content: center;
align-items: center;
flex-direction: column;
.email{
width: 100%;
input,textarea{
#include contact_form_input_style;
}
textarea{
resize: none;
height: 100px;
}
}
.name{
display: flex;
width: 100%;
input{
#include contact_form_input_style;
}
}
}
<form method="post" action="" class="contact-form">
<div class="name">
<input type="text"/>
<input type="text"/>
</div>
<div class="email">
<input type="email"/>
<textarea></textarea>
</div>
<input type="submit" value="submit" name="submit">
</form>
Change the .contact-form .email div to flex so the children won't go outside the parent space
.contact {
display: flex;
justify-content: center;
align-items: center;
height: 60vh;
width: 100%;
}
.contact-form {
display: flex;
width: 60%;
justify-content: center;
align-items: center;
flex-direction: column;
}
.contact-form .name {
display: flex;
width: 100%;
}
.contact-form .name input {
width: 100%;
background-color: grey;
border: none;
border-radius: 10px;
height: 50px;
padding: 10px;
margin: 10px;
}
.contact-form .email {
display: flex;
flex-direction: column;
width: 100%;
}
.contact-form .email input,
.contact-form .email textarea {
background-color: grey;
border: none;
border-radius: 10px;
height: 50px;
padding: 10px;
margin: 10px;
}
.contact-form .email textarea {
resize: none;
height: 100px;
}
<form method="post" action="" class="contact-form">
<div class="name">
<input type="text" />
<input type="text" />
</div>
<div class="email">
<input type="email" />
<textarea></textarea>
</div>
<input type="submit" value="submit" name="submit">
</form>

Div with 100% height becomes shorter than 100% when viewport is vertically resized

I have a div which has height:100%; but when I resize the window vertically this happens (look at the nav-bar on the left):
Here is the jsfiddle: https://jsfiddle.net/uygxjbr2/2/
This is the faulty element:
.nav {
/* position: fixed; */
width: 250px;
height: 100%;
min-height: 100%;
}
.nav ul {
list-style-type: none;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 40% 0;
height: 100%;
color: #fff;
background-color: #40404a;
}
I've tried using /* position: fixed; */ but that destroys the whole page design.
Also, another issue that I've noticed is that when I vertically resize the window the top of the .upper-page disappears, making it unscrollable.
What can I do ?
Okay so if i understood correctly your aim is that the Navbar on the side is always full body-size in height. First of all: dont add style to the html itself, always use the body for that. height does not work like width with % it only works if you have a relation, so 100% works if the parent element has a fixed height, so 100% on body and html wont work correctly. Therefore i suggest the following changes:
html {
/*height: 100%; <--- remove this! */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: sans-serif;
}
body {
/*height: 100%; <--- change this to the code below:*/
min-height: 100vh;
margin: 0;
padding: 0;
display: flex;
background-color: #28282f;
}
.nav {
width: 250px;
/*height: 100%; <--- remove this! */
min-height: 100%;
}
With this your body is always the same height as your screen and the navbar will always be 100% of the body. This, atleast in my tests, removed the gap below the navbar.
Add this styles to your CSS. I think that will be enough to solve the problem.
.nav {
position: fixed;
width: 250px;
height: 100%;
min-height: 100%;
}
#media (min-width: 900px) {
#page {
margin-left: 250px;
}
}
#media (max-width: 900px) {
.nav {
width: 100%;
z-index: 1;
min-height: auto;
height: auto;
}
}
Example:
* {
box-sizing: border-box;
padding: 0;
margin: 0;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
html {
height: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: sans-serif;
}
body {
height: 100%;
margin: 0;
padding: 0;
display: flex;
background-color: #28282f;
}
/* Chrome, Firefox, Opera, Safari 10.1+ */
::placeholder {
color: #cfcfd5;
opacity: 1;
/* Firefox */
}
/* Internet Explorer 10-11 */
:-ms-input-placeholder {
color: #cfcfd5;
}
/* Microsoft Edge */
::-ms-input-placeholder {
color: #cfcfd5;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
a,
a:hover,
a:focus,
a:visited {
color: #fff;
text-decoration: none;
}
.nav {
position: fixed;
width: 250px;
height: 100%;
min-height: 100%;
}
.nav ul {
list-style-type: none;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 40% 0;
height: 100%;
color: #fff;
background-color: #40404a;
}
.nav ul li {
width: 100%;
background-color: #646474;
padding: 15px;
border: 1px solid #28282f;
}
.nav ul li:hover {
background-color: #898999;
cursor: pointer;
}
.nav ul .active {
background-color: #898999;
}
#page {
position: relative;
width: 100%;
color: white;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
span {
display: inline-block;
}
.upper-page,
.middle-page,
.lower-page {
position: relative;
margin: 0 auto;
width: 90%;
max-width: 1000px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #40404a;
padding-bottom: 10px;
}
.lower-page {
margin-top: 20px;
}
.title,
.info {
background-color: #4c4c58;
}
.current-settings,
.change-settings,
.logs {
background-color: #646474;
}
.title,
.wrapper-title {
font-size: 20px;
font-weight: bold;
width: 100%;
max-width: 1000px;
padding: 10px;
text-align: left;
}
.wrapper-title {
padding-top: 40px;
padding-left: 25px;
font-size: 24px;
}
.wrapper {
width: 100%;
max-width: 1000px;
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
padding-bottom: 10px;
}
.current-settings,
.change-settings,
.logs {
width: 45%;
max-width: 600px;
display: flex;
flex-direction: column;
align-items: center;
padding: 10px;
}
.upper-page .current-settings,
.upper-page .change-settings {
height: 560px;
}
.middle-page .current-settings,
.middle-page .change-settings {
height: 650px;
}
.settings {
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
}
.settings,
.change-settings {
font-size: 14px;
padding: 10px;
}
.settings span {
padding: 20px 0;
letter-spacing: 0.5px;
}
.change-settings .info {
padding: 10px;
width: 100%;
letter-spacing: 0.2px;
}
.change-settings input {
margin: 5px 0;
padding: 10px;
width: 100%;
color: #fff;
background-color: #52525f;
border: none;
font-size: 16px;
letter-spacing: 0.5px;
}
.inputs {
display: flex;
flex-direction: row;
width: 100%;
justify-content: space-around;
align-items: center;
}
.inputs .color {
margin-left: 10px;
padding: 5px;
height: 38px;
border: none;
width: 80px;
}
.change-settings .wrong {
color: #e11422;
font-weight: 700;
}
.change-settings .correct {
color: #14e16d;
font-weight: 700;
}
.change-settings label {
padding: 5px 0;
font-weight: bold;
letter-spacing: 0.5px;
}
.change-settings .button {
display: inline-block;
width: 50%;
margin: 0 auto;
margin-top: 20px;
background-color: #28282f;
}
.change-settings .button:hover {
background-color: #4c4c58;
cursor: pointer;
}
.logs {
width: 95%;
max-width: none;
height: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
line-height: 25px;
}
.middle-page .user-settings {
height: auto;
}
.user-title {
text-align: center;
}
#media (max-width: 900px) {
body {
flex-direction: column;
justify-content: flex-start;
}
.nav {
width: 100%;
}
.nav ul {
width: 100%;
flex-direction: row;
justify-content: center;
padding: 0;
}
.nav ul li {
padding: 10px 5px;
font-size: 14px;
}
#page {
padding: 50px 0;
}
.wrapper {
flex-direction: column;
}
.wrapper-title {
padding: 40px 5% 0;
}
.upper-page .current-settings,
.upper-page .change-settings,
.middle-page .current-settings,
.middle-page .change-settings {
width: 90%;
margin: 10px 0;
height: auto;
}
.logs {
width: 90%;
max-width: 600px;
}
.settings span {
padding: 5px 0;
}
.change-settings .info {
padding: 10px;
}
.change-settings input {
margin: 5px 0;
padding: 10px;
font-size: 14px;
}
.change-settings label {
padding: 5px 0;
}
}
#media (min-width: 900px) {
#page {
margin-left: 250px;
}
}
#media (max-width: 900px) {
.nav {
width: 100%;
z-index: 1;
min-height: auto;
height: auto;
}
}
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="scripts.js" defer></script>
<div class="nav">
<ul>
<a href="/display">
<li class="active">Display Settings</li>
</a>
<a href="/network">
<li>Network Settings</li>
</a>
<a href="/user">
<li>Create/Change User</li>
</a>
</ul>
</div>
<div id="page">
<div class="upper-page">
<span class="wrapper-title">Display Settings</span>
<div class="wrapper">
<div class="current-settings">
<span class="title">Current Settings</span>
<div class="settings">
<span>Brightness: %ph_brightness% (%)</span>
<span>Idle Messsage: %ph_message%</span>
<span>Timer 1 (%ph_GPIO_1%): %ph_timer_1%</span>
<span>Timer 2 (%ph_GPIO_2%): %ph_timer_2%</span>
<span>Timer 3 (%ph_GPIO_3%): %ph_timer_3%</span>
</div>
</div>
<div class="change-settings">
<span class="title">Change Settings</span>
<span class="info">
Here you can change the display's settings.
</span>
<form method="post" class="settings">
<label for="brightness">Brightness: </label>
<input type="text" name="brightness" id="brightness" placeholder="Brightness" />
<label for="idle">Idle Message: </label>
<div class="inputs">
<input type="text" name="idle" id="idle" placeholder="Idle Message" />
<input type="color" list="idleColor" name="idleColor" class="color" />
<datalist id="idleColor">
<option value="#ffffff"></option>
<option value="#ff0000"></option>
<option value="#ff7f00"></option>
<option value="#00ff00"></option>
<option value="#0000ff"></option>
<option value="#00ffff"></option>
<option value="#8f00ff"></option>
</datalist>
</div>
<label for="timer1">Timer 1 (%ph_GPIO_1%): </label>
<div class="inputs">
<input type="text" name="timer1" id="timer1" placeholder="Timer 1" />
<input type="color" list="timer1Color" name="timer1Color" class="color" />
<datalist id="timer1Color">
<option value="#ffffff"></option>
<option value="#ff0000"></option>
<option value="#ff7f00"></option>
<option value="#00ff00"></option>
<option value="#0000ff"></option>
<option value="#00ffff"></option>
<option value="#8f00ff"></option>
</datalist>
</div>
<label for="timer2">Timer 2 (%ph_GPIO_2%): </label>
<div class="inputs">
<input type="text" name="timer2" id="timer2" placeholder="Timer 2" />
<input type="color" list="timer2Color" name="timer2Color" class="color" />
<datalist id="timer2Color">
<option value="#ffffff"></option>
<option value="#ff0000"></option>
<option value="#ff7f00"></option>
<option value="#00ff00"></option>
<option value="#0000ff"></option>
<option value="#00ffff"></option>
<option value="#8f00ff"></option>
</datalist>
</div>
<label for="timer3">Timer 3 (%ph_GPIO_3%): </label>
<div class="inputs">
<input type="text" name="timer3" id="timer3" placeholder="Timer 3" />
<input type="color" list="timer3Color" name="timer3Color" class="color" />
<datalist id="timer3Color">
<option value="#ffffff"></option>
<option value="#ff0000"></option>
<option value="#ff7f00"></option>
<option value="#00ff00"></option>
<option value="#0000ff"></option>
<option value="#00ffff"></option>
<option value="#8f00ff"></option>
</datalist>
</div>
<input class="button" type="submit" name="save_display" value="Save Settings" />
</form>
</div>
</div>
</div>
<div class="lower-page">
<div class="wrapper-title">Logs</div>
<div class="wrapper">
<div class="logs">%ph_logs%</div>
</div>
</div>
</div>
The gap below .nav is because your right div is overflowing in height. Instead of using height: 100% on your body (as per your code), give it a min-height: 100%. This should fix the overflowing issue and also make sure the nav element takes full height.
The easy way is a view height 100% and an outer page-wrapper with min-height 100%
<body>
<div class="page-wrapper">
<div class="nav">
....
</div>
<div id="page">
....
</div>
</div>
</body>
/* keep padding and border in the elements */
* {
box-sizing: border-box;
}
/* the view height is 100% */
html, body {
height: 100:
}
/* remove default margin of body */
body {
margin: 0;
}
/* the main wrapper with a min-height 100% */
/* or, if using bootstrap: body > .container { these 3 lines } */
.page-wrapper {
max-width: 100%;
min-height: 100%;
margin: auto;
}
/* below all your css */
.nav {
width: 250px;
...
}
#page {
width: 100%;
...
}

How do I enlarge the area in which someone can type in the input field?

Simple question really. If I use height: 100px the cursor is still starting in the middle of the input box. I'd like to use the entire box with the cursor starting at the top left to make a more intuitive paragraph writing experience.
I'm simply making a form. When I add width: ***px; you can type to the edge of the extended input box however the same doesn't happen for height: ***px;.
input {
border: 1px solid black;
border-radius: 5px;
padding: 2px 0 2px 10px;
width: 150px;
height: 20px;
margin: 5px 0 0 0;
}
.form {
margin: 50px 0 100px 0;
}
.form>div {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.form-box {
margin: 0 0 20px 0;
}
.text-box {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.main-kart {
width: 400px;
height: 250px;
float: right;
margin: 5px 5px 5px 5px;
}
.main-engine {
width: 300px;
height: 200px;
float: left;
}
.cat {
width: 250px;
height: 150px;
float: right;
}
.description {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.description>input {
width: 500px;
}
.sub-m {
margin: 0 0 5px 0;
}
.desc-box {
height: 100px
}
<div class="description">
<label class="sub-m" for="Sub">Subject</label>
<input class="form-box" type="text" id="Sub" maxlength="95" required>
<label for="text-box">Description</label>
<input type="text" id="text-box" class="desc-box" maxlength="200" required>
</div>
You can’t change input control’s height. If you want paragraph writing experience use textarea html tag
You should use a textarea instead of an input. This is a multi-line plain-text editing control.
Here is your code updated with a textarea:
input {
border: 1px solid black;
border-radius: 5px;
padding: 2px 0 2px 10px;
width: 150px;
height: 20px;
margin: 5px 0 0 0;
}
textarea {
border: 1px solid black;
border-radius: 5px;
padding: 2px 0 2px 10px;
width: 500px;
}
.form {
margin: 50px 0 100px 0;
}
.form > div {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.form-box {
margin: 0 0 20px 0;
}
.text-box {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.main-kart {
width: 400px;
height: 250px;
float: right;
margin: 5px 5px 5px 5px;
}
.main-engine {
width: 300px;
height: 200px;
float: left;
}
.cat {
width: 250px;
height: 150px;
float: right;
}
.description {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.description > input {
width: 500px;
}
.sub-m {
margin: 0 0 5px 0;
}
.desc-box {
height: 100px
}
<div class="description">
<label class="sub-m" for="Sub">Subject</label>
<input class="form-box" type="text" id="Sub" maxlength="95" required>
<label for="text-box">Description</label>
<textarea type="text" id="text-box" class="desc-box" maxlength="200" required>
</textarea>
</div>
If you want multi-line support, like a paragraph, use <textarea> instead of <input type="text">. An <input> will only give you a single line.
You can set a default height of an <textarea> with the rows attribute or set a min-height via CSS.
textarea {
width: 100%;
/* min-height: 150px; */
}
<textarea name="comments" rows="8"></textarea>