RWD flexbox form not working - css

I have one simple question :
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
background-image: url("IMG/tlo.jpg");
background-size: cover;
font-family: "Titillium Web", sans-serif;
}
.top-container {
display: flex;
justify-content: center;
align-items: center;
opacity: 0.42;
margin-top: 1rem;
}
.main-container {
display: flex;
flex-wrap: wrap;
flex-direction: column;
max-height: 1200px;
align-items: center;
align-content: center;
margin-top: 1.25rem;
margin-bottom: 1.25rem;
margin: 0 -5px;
}
.h2 {
font-size: 2rem;
text-shadow: 1px 2px 2px #2b0100;
color: #FFFFFF;
}
.rf-container {
display: flex;
margin: 0 55px;
width: 380px;
background-color: #f4f4f4;
padding: 20px 20px;
box-shadow: 0px 0px 0px 20px rgba(0,0,0,0.24);
}
.form-rf {
display: flex;
flex-direction: column;
flex: 1;
}
.rf-element {
display:flex;
background-color: #f8f8f8;
border: 1px solid #c6c6c6;
border-radius: 2px;
margin-bottom: 1.25rem;
height: 2.5rem;
width: 340px;
}
.rf-element:hover {
border-color: #88c814;
}
.main-icon {
width: 45px;
flex: 2;
color: #dedede;
font-size: 1.375rem;
text-align: center;
padding-top: 1%;
}
.main_field {
flex: 10;
height: 100%;
border: none;
background-color: #f8f8f8;
font-family: 'Titillium Web', sans-serif;
font-size: 1rem;
color: #afafaf;
padding-left: 3%;
outline: none;
border-style: none;
}
.main_field:focus {
color: #428c42;
box-shadow: 0 0 10px 2px rgba(204,204,204,0.9);
border: 2px solid #a5cda5;
background-color: #e9f3e9;
}
.separator {
display: flex;
width: 5px;
min-height: 100%;
background-color: #dedede;
border-top: 0.1875rem solid #f8f8f8;
border-bottom: 0.1875rem solid #f8f8f8;
}
/* checkbox */
.checkbox-custom {
opacity: 0;
position: absolute;
}
.checkbox-custom, .checkbox-custom-label {
display: inline-block;
vertical-align: middle;
margin: 0.3125rem;
cursor: pointer;
}
.checkbox-custom-label{
position: relative;
}
.checkbox-custom + .checkbox-custom-label:before{
content: '';
background: #fff;
border: 0.125rem solid #ddd;
display: inline-block;
vertical-align: middle;
width:1.25rem;
height: 1.25rem;
padding: 0.125rem;
margin-right: 0.625rem;
text-align: center;
}
.checkbox-custom:checked + .checkbox-custom-label:before {
content: "";
background: #428c42;
}
/* checkbox end */
.main_green_button {
margin-top: 0.5rem;
width: 100%;
border: 0.0625rem solid #3b9a00;
border-radius: 0.125rem;
font-size: 1.5rem;
font-family: 'Titillium Web', sans-serif;
color: #FFFFFF;
text-shadow: 0.0625rem 0.0625rem #51850e;
background: linear-gradient(#a3d840, #73b618);
height: 3rem;
box-shadow: 0.0625rem 0.0625rem 0.0625rem 0px #FFFFFF;
cursor: pointer;
}
.main_green_button:hover {
background: linear-gradient(#AAE650, #7DC323);
}
.main_green_button_smaller {
height: 2.1875rem;
font-size: 1rem;
width: 45%;
}
.main_green_button_smaller-disabled {
opacity: 0.5;
cursor: no-drop;
}
.main_green_button_smaller-warning {
background: linear-gradient(#f65e70, #f03747);
border: 1px rgba(209, 18, 18, 0.616);
}
.main_green_button_smaller-warning:hover {
background: linear-gradient(#FF697D, #FA4155);
}
/* button end */
/* text area*/
.textarea {
width: 100%;
margin-bottom: 1.25rem;
background-color: #f8f8f8;
border: 0.0625rem solid #c6c6c6;
border-radius: 1.5px;
font-family: 'Titillium Web', sans-serif;
font-size: 1rem;
color: #afafaf;
resize: none;
}
.doublebtn {
display: flex;
justify-content: space-between;
align-items: center;
}
.footer {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
align-items: center;
opacity: 0.5;
}
.footer_top {
margin: 3.125rem 0px 0.5rem 0px;
}
/* MEDIA*/
#media only screen and (max-width: 945px) {
.main-container {
max-height: 3100px;
}
}
#media only screen and (max-width: 480px) {
.main-container {
margin: 0 auto;
}
.rf-container {
margin: 0 auto;
}
.rf-element {
}
.main_field {
}
.doublebtn {
}
}
<section class="main-container">
<!-- REGISTER FORM -->
<h2 class="h2">Register Form</h2>
<div class="rf-container">
<form action="" class="form-rf">
<!-- REGISTER FORM / 1 row -->
<div class="rf-element">
<div class="main-icon">
<i class="fa fa-user" aria-hidden="true"></i>
</div>
<div class="separator"></div>
<input class="main_field" type="text" name="username"placeholder="Username" onfocus="this.placeholder=''" onblur="this.placeholder='Username'" required>
</div>
<!-- REGISTER FORM / 2 row -->
<div class="rf-element">
<div class="main-icon">
<i class="fa fa-lock" aria-hidden="true"></i>
</div>
<div class="separator"></div>
<input class="main_field" type="password" name="password"placeholder="Password"
onfocus="this.placeholder=''" onblur="this.placeholder='Password'" required>
</div>
<!-- REGISTER FORM / 3 row -->
<div class="rf-element">
<div class="main-icon">
<i class="fa fa-lock" aria-hidden="true"></i>
</div>
<div class="separator"></div>
<input class="main_field" type="password" name="Confirm Password"placeholder="Confirm Password" onfocus="this.placeholder=''" onblur="this.placeholder='Confirm Password'" required>
</div>
<!-- REGISTER FORM / 4 row -->
<div class="rf-element">
<div class="main-icon">
<i class="fa fa-envelope" aria-hidden="true"></i>
</div>
<div class="separator"></div>
<input class="main_field" type="email" name="Email"placeholder="Email" onfocus="this.placeholder=''" onblur="this.placeholder='Email'" required>
</div>
<!-- REGISTER FORM / 5 row -->
<div class="rf-element">
<div class="main-icon">
<i class="fa fa-map-marker" aria-hidden="true"></i>
</div>
<div class="separator"></div>
<select class="main_field" name="location" required>
<option value="" disabled selected>Your Location</option>
<option value="gdansk">Gdańsk</option>
<option value="krakow">Kraków</option>
<option value="poznan">Poznań</option>
<option value="warszawa">Warszawa</option>
<option value="wroclaw">Wrocław</option>
</select>
</div>
<!-- REGISTER FORM / 6 row -->
<input id="checkbox-1" class="checkbox-custom" name="checkbox-1" type="checkbox" >
<label for="checkbox-1" class="checkbox-custom-label">I have read and accept the terms of use.</label>
<!-- REGISTER FORM / sign in -->
<input class="main_green_button" type="submit" value="Sign up">
</form>
</div>
</section>
codepen all
when I try make responsive,u see that forms do not fit on the page.
In fact, no element is responsive despite the use FLEXBOX.
I tried to combine using values flex: 1 1 auto; or flex: 1 1 80% an excuse for .main-field input .
In short - I would like to receive responsive forms, but at the moment I have no idea how to deal with it.

Related

CSS - Second "line" in a navbar

I am trying to create a navbar with two "lines".
The first line would include some links and the second one a HTML select with a submit.
The code below generates the navbar like this:
body {
margin: 0;
}
.navbar {
display: flex;
flex-wrap: wrap;
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
.navbar-item {
background-color: #333;
/*flex-grow: 4;*/
}
.navbar-search {
background-color: #333;
align-self: center;
}
.navbar a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.navbar a:hover {
background: #ddd;
color: black;
}
.main {
padding: 16px;
margin-top: 30px;
height: 1500px;
/* Used in this example to enable scrolling */
}
<div class="navbar">
<div class="navbar-item">Home</div>
<div class="navbar-item">Links</div>
<div class="navbar-item">Contact</div>
<div class="navbar-search">
<select name="slct" id="my-slct">
<option value="">--Please choose an option--</option>
</select>
<input type="submit" />
</div>
</div>
I tried to add some <br /> but it didn't do the job.
How can I put the search div right below the home link?
Add width: 100% on .navbar-search
body {margin:0;}
.navbar {
display: flex;
flex-wrap: wrap;
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
.navbar-item {
background-color: #333;
/*flex-grow: 4;*/
}
.navbar-search {
background-color: #333;
align-self: center;
padding: 0 15px 10px;
width: 100%;
}
.navbar a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.navbar a:hover {
background: #ddd;
color: black;
}
.main {
padding: 16px;
margin-top: 30px;
height: 1500px; /* Used in this example to enable scrolling */
}
<div class="navbar">
<div class="navbar-item">Home</div>
<div class="navbar-item">Links</div>
<div class="navbar-item">Contact</div>
<div class="navbar-search">
<select name="slct" id="my-slct">
<option value="">--Please choose an option--</option>
</select>
<input type="submit" />
</div>
</div>
If you don't want the search item to take up the full width of the navbar, you can force a line break with a "collapsed row":
body {
margin: 0;
}
.navbar {
display: flex;
flex-wrap: wrap;
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
.navbar-item {
background-color: #333;
/*flex-grow: 4;*/
}
.navbar-break {
flex-basis: 100%;
height: 0;
}
.navbar-search {
background-color: #333;
align-self: center;
}
.navbar a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.navbar a:hover {
background: #ddd;
color: black;
}
.main {
padding: 16px;
margin-top: 30px;
height: 1500px;
/* Used in this example to enable scrolling */
}
<div class="navbar">
<div class="navbar-item">Home</div>
<div class="navbar-item">Links</div>
<div class="navbar-item">Contact</div>
<div class="navbar-break"></div>
<div class="navbar-search">
<select name="slct" id="my-slct">
<option value="">--Please choose an option--</option>
</select>
<input type="submit" />
</div>
</div>
Breaking to a new row with flexbox | Tobias Ahlin

Why are my CSS elements spacing out by themselves?

Im working on a project, but my elements are very spaced out and I'm not the best at CSS. I don't know if it's doing it on it's own or something is wrong with my CSS. Can you please help find the problem?
<body>
<div class='top'>
<div class='top-left'>
<input type='text' class='info' id='totalBill' placeholder='Total bill'>
<input type='text' class='info' id='peopleAmount' placeholder='People'>
</div>
<div class='top-right'>
<div class='tip'>
<input type='text' class='info' id='tip' placeholder='Tip (in percent)'>
</div>
<button onclick = "calculate()"> Calculate </button>
</div>
</div>
<div class="bottom">
<input id="output" disabled>
<input id="moneyOutput" disabled>
</div>
</body>
</html>
CSS File Link - https://aaryank.codewizardshq.com/BillSplitter/style.css
Just replace the justify-content: space-around; to the justify-content: center; this will leave small space between your inputs and also reduce the height if you like like the following in your edited code
* {
outline: none;
border: none;
font-family: 'Fira Sans', sans-serif;
margin: 0;
}
.top-left,
.top-right {
position: absolute;
height: 60vh;
width: 50vw;
top: 0;
}
.top-right {
right: 0;
background: #7ACFD7;
}
.top-left {
left: 0;
background-color: #C22629;
}
.bottom {
position: absolute;
height: 40vh;
/*edited from height: 60vh;*/
width: 100vw;
bottom: 0;
left: 0;
background-color: #F1EFEE;
}
.top-left,
.top-right,
.bottom {
flex-direction: column;
display: flex;
justify-content: center;
/*Edited from justify-content: space-around;*/
place-items: center;
}
/**/
input[class='info'] {
font-size: 20px;
padding: 15px;
border-radius: 5px;
background: #FFF;
margin: 10px;
font-family: 'Fira Sans', sans-serif;
display: block;
}
input,
input::placeholder {
color: grey;
}
button {
font-size: 18px;
padding: 15px;
width: 50%;
;
background-color: transparent;
color: #F1EFEE;
border: 3px solid #F1EFEE;
border-radius: 10px;
cursor: pointer;
}
#output {
font-size: 20px;
background-color: transparent;
border-radius: 5px;
text-align: center;
color: black;
width: 50%;
}
#moneyOutput {
font-size: 50px;
padding: 5px;
background-color: transparent;
border-radius: 5px;
text-align: center;
color: black;
width: 50%;
}
<div class='top'>
<div class='top-left'>
<input type='text' class='info' id='totalBill' placeholder='Total bill'>
<input type='text' class='info' id='peopleAmount' placeholder='People'>
</div>
<div class='top-right'>
<div class='tip'>
<input type='text' class='info' id='tip' placeholder='Tip (in percent)'>
</div>
<button onclick="calculate()"> Calculate </button>
</div>
</div>
<div class="bottom">
<input id="output" disabled>
<input id="moneyOutput" disabled>
</div>

Button getting hidden

how can I do so that the button is not hidden when resizing the modal?
I'm having trouble solving this problem can someone help me?
I believe it must be simple to solve, I just couldn't find the solution yet
below is the JSX code (React) and CSS code
if you look at the image you will be better able to understand the problem
JSX (React) code below:
<Modal open={this.props.open} visible={this.props.visible}>
<div class={style.Container}>
<div class={style.Header}>
<div class={style.Title}>{data.subject}</div>
<div
class={style.Buttons2}
onClick={(event) => this.props.visible(false)}
>
<MdBackspace size="24px" color="#FFF" />
</div>
</div>
<form onSubmit={this.handleSubmit} class={style.Wrapper}>
<div class={style.Message}>
{ReactHtmlParser(this.state.message)}
</div>
<div class={style.Editor}>
<ReactQuill
value={this.state.content}
onChange={this.handleType}
/>
</div>
<div class={style.Controls}>
<input type="file" multiple onChange={this.fileSelected} />
{this.state.buttonState ? (
<button class={style.SendButton} type="submit">
Enviar
</button>
) : (
<button class={style.ButtonDisabled} disabled>
Enviar
</button>
)}
</div>
</form>
</div>
</Modal>
CSS code below:
.Container {
width: 720px;
display: flex;
flex: 1 1 100%;
flex-direction: column;
background: #f9f9f9;
border-radius: 5px;
border: 2px solid #405c77;
resize: both;
overflow: auto;
}
.Header {
width: 100%;
display: flex;
justify-content: space-between;
background: #405c77;
padding: 20px;
flex-wrap: wrap;
}
.Title {
color: #fff;
font-weight: 700;
font-size: 16px;
}
.Wrapper {
/* flex: 1 1 100%; */
height: 100%;
display: grid;
/* grid-template-rows: 60% 30% 40px; */
grid-template-rows: minmax(5px, 1fr);
}
.Message {
/* height: 100%; */
margin: 10px;
padding: 10px;
display: grid;
border-radius: 5px;
overflow-y: auto;
background: #fff;
border: 1px solid rgba(0, 0, 0, 0.111);
}
.Editor {
height: calc(30% - 40px);
/* height: 100%; */
margin: 10px;
}
textarea {
width: 100%;
height: 160px;
resize: none;
padding: 5px;
}
.Buttons2 {
cursor: pointer;
background-color: transparent;
outline: none;
border: none;
}
.SendButton {
display: flex;
justify-content: flex-end;
align-items: center;
height: 30px;
cursor: pointer;
padding: 10px;
border: none;
text-transform: uppercase;
font-weight: 700;
border-radius: 5px;
outline: none;
background: rgba(64, 92, 119, 0.8);
transition: all 0.1s ease-in-out;
color: #fff;
}
.SendButton:hover {
transition: all 0.1s ease-in-out;
background: rgba(64, 92, 119, 0.999);
}
.ButtonDisabled {
display: flex;
justify-content: flex-end;
align-items: center;
width: 60px;
height: 30px;
background: red;
padding: 10px;
border: none;
text-transform: uppercase;
font-weight: 700;
border-radius: 5px;
outline: none;
color: #fff;
}
.Controls {
/* height: 40px; */
/* height: 100%; */
display: flex;
flex: 1 1 100%;
flex-wrap: nowrap;
justify-content: space-between;
}
.Controls input {
margin-top: 12px;
cursor: pointer;
padding: 12px;
border: none;
text-transform: uppercase;
font-weight: 700;
border-radius: 5px;
outline: none;
}
Maybe try putting your button inside the Editor div?
<div class={style.Editor}>
<ReactQuill
value={this.state.content}
onChange={this.handleType}
/>
<div class={style.Controls}>
<input type="file" multiple onChange={this.fileSelected} />
{this.state.buttonState ? (
<button class={style.SendButton} type="submit">
Enviar
</button>
) : (
<button class={style.ButtonDisabled} disabled>
Enviar
</button>
)}
</div>
</div>
Its difficult without being able to inspect it properly
try this:
{
position:fixed;
top:0;
z-index:5;
}

How to align input fields among themselves without getting in trouble with label widths [duplicate]

This question already has answers here:
Setting the width of inline elements
(7 answers)
Closed 4 years ago.
I am trying to design a form so, that the input fields are among themselves. I tried it by giving the labels before the input-fields a width so that even if the label-text is shorter, space is the same. It worked in a youtube video, but I can't get it working for some reason. Whichever width I give it to the label, nothing changes. I guess it's a really simple error made by me, which gets me hardly frustrated.
body,
html {
background-color: aquamarine;
background-image: url(../background.jpg);
height: 100%;
overflow-y: hidden;
margin: 0;
}
#Wrapper {
margin-left: 15%;
margin-right: 15%;
height: 100vh;
}
/*
************************************************
Hier beginnt das Header-Styling"
************************************************
*/
header {
position: relative;
background-color: blueviolet;
margin: 0;
display: flex;
justify-content: space-between;
align-items: center;
flex: 0 1 60%;
padding: 0 1rem;
border-radius: 0em 0em 1em 1em;
height: 56px;
}
header img {
width: 2.5em;
height: 2.5em;
}
#branding {
position: absolute;
left: 2em;
margin: 0;
margin-left: 0.3em;
font-family: 'Yanone Kaffeesatz', sans-serif;
color: lawngreen;
}
.nav {
display: flex;
flex: 0 1 25%;
justify-content: space-between;
align-items: center;
}
.navitem {
list-style: none;
}
.navitem a {
font-size: 20px;
margin-top: 0;
color: black;
text-decoration: none;
font-family: 'Anton', sans-serif;
}
.navitem a {}
.navitem a:hover {
color: rgba(0, 0, 0, 0.6);
cursor: pointer;
}
/*
************************************************
Header-Styling ENDE
************************************************
*/
main {
display: flex;
flex-direction: column;
align-items: center;
width: 80%;
height: calc(100vh - 56px);
background-color: white;
margin: 0;
margin-right: auto;
margin-left: auto;
overflow-y: auto;
border: 1px solid Maroon;
border-top: 0px;
}
main h2 {
margin: 1em;
font-family: 'Anton', sans-serif;
}
main h4 {
font-size: 2em;
}
/*
************************************************
Hier beginnt das Tabellen-Styling"
************************************************
*/
table {
padding: 1em;
background-color: lightgray;
}
table tr {}
table th {
font-size: 1.5em;
}
table td {
font-weight: 700;
text-align: center;
border-right: 1px solid gray;
border-bottom: 1px solid gray;
padding: 3em;
}
table td:last-child {
border-right: 0px;
padding: 0.3em;
}
td img {
height: 11em;
width: 11em;
}
/*
************************************************
Tabellen-Styling ENDE
************************************************
*/
/*
************************************************
Hier beginnt das Formular Styling
************************************************
*/
form {
padding: 8em;
background-color: slategray;
}
.forms label {
width: 2em;
}
<link href="https://fonts.googleapis.com/css?family=Anton|Baloo+Bhaijaan|Gloria+Hallelujah|PT+Sans+Narrow|Righteous|Titillium+Web|Yanone+Kaffeesatz" rel="stylesheet">
<div id="Wrapper">
<header>
<img src="logo.png">
<h1 id="branding">Einfache-Rezepte</h1>
<ul class="nav">
<li class="navitem active">Startseite</li>
<li class="navitem">Rezepte</li>
<li class="navitem">Kontakt</li>
</ul>
</header>
<main>
<form action="mailto:Email" method="post">
<h3>Kontaktiere uns!</h3>
<div class="forms">
<label for="vname">Vorname:</label>
<input type="text" id="vname" name="Vorname">
</div>
<div class="forms">
<label for="nname">Nachname:</label>
<input type="text" id="nname" name="Nachname">
</div>
<div class="forms">
<label for="msg">Ihre Nachricht:</label>
<textarea name="nachricht" cols="40" rows="10"></textarea>
</div>
<input type="submit" value="Absenden">
<input type="reset" value="Zurücksetzen">
</form>
</main>
</div>
CodePen: https://codepen.io/anon/pen/qJeQNe
You are missing display:inline-block; on label style. By default label elements are inline and to assign a width you need to change it to inline-block.
Check the Snippet below:
body,
html {
background-color: aquamarine;
background-image: url(../background.jpg);
height: 100%;
overflow-y: hidden;
margin: 0;
}
#Wrapper {
margin-left: 15%;
margin-right: 15%;
height: 100vh;
}
/*
************************************************
Hier beginnt das Header-Styling"
************************************************
*/
header {
position: relative;
background-color: blueviolet;
margin: 0;
display: flex;
justify-content: space-between;
align-items: center;
flex: 0 1 60%;
padding: 0 1rem;
border-radius: 0em 0em 1em 1em;
height: 56px;
}
header img {
width: 2.5em;
height: 2.5em;
}
#branding {
position: absolute;
left: 2em;
margin: 0;
margin-left: 0.3em;
font-family: 'Yanone Kaffeesatz', sans-serif;
color: lawngreen;
}
.nav {
display: flex;
flex: 0 1 25%;
justify-content: space-between;
align-items: center;
}
.navitem {
list-style: none;
}
.navitem a {
font-size: 20px;
margin-top: 0;
color: black;
text-decoration: none;
font-family: 'Anton', sans-serif;
}
.navitem a {}
.navitem a:hover {
color: rgba(0, 0, 0, 0.6);
cursor: pointer;
}
/*
************************************************
Header-Styling ENDE
************************************************
*/
main {
display: flex;
flex-direction: column;
align-items: center;
width: 80%;
height: calc(100vh - 56px);
background-color: white;
margin: 0;
margin-right: auto;
margin-left: auto;
overflow-y: auto;
border: 1px solid Maroon;
border-top: 0px;
}
main h2 {
margin: 1em;
font-family: 'Anton', sans-serif;
}
main h4 {
font-size: 2em;
}
/*
************************************************
Hier beginnt das Tabellen-Styling"
************************************************
*/
table {
padding: 1em;
background-color: lightgray;
}
table tr {}
table th {
font-size: 1.5em;
}
table td {
font-weight: 700;
text-align: center;
border-right: 1px solid gray;
border-bottom: 1px solid gray;
padding: 3em;
}
table td:last-child {
border-right: 0px;
padding: 0.3em;
}
td img {
height: 11em;
width: 11em;
}
/*
************************************************
Tabellen-Styling ENDE
************************************************
*/
/*
************************************************
Hier beginnt das Formular Styling
************************************************
*/
form {
padding: 8em;
background-color: slategray;
}
.forms label {
width: 5em;
display:inline-block;
}
<link href="https://fonts.googleapis.com/css?family=Anton|Baloo+Bhaijaan|Gloria+Hallelujah|PT+Sans+Narrow|Righteous|Titillium+Web|Yanone+Kaffeesatz" rel="stylesheet">
<div id="Wrapper">
<header>
<img src="logo.png">
<h1 id="branding">Einfache-Rezepte</h1>
<ul class="nav">
<li class="navitem active">Startseite</li>
<li class="navitem">Rezepte</li>
<li class="navitem">Kontakt</li>
</ul>
</header>
<main>
<form action="mailto:Email" method="post">
<h3>Kontaktiere uns!</h3>
<div class="forms">
<label for="vname">Vorname:</label>
<input type="text" id="vname" name="Vorname">
</div>
<div class="forms">
<label for="nname">Nachname:</label>
<input type="text" id="nname" name="Nachname">
</div>
<div class="forms">
<label for="msg">Ihre Nachricht:</label>
<textarea name="nachricht" cols="40" rows="10"></textarea>
</div>
<input type="submit" value="Absenden">
<input type="reset" value="Zurücksetzen">
</form>
</main>
</div>
You can test it here also.

Why when resizing window there is no space on the left of the input fields?

I have a really quick question. I have developed this css and html with the help of a YouTube tutorial as well as the community. However, I do have a problem and I have spent a good hour trying to solve it but have had no luck. When I resize the window, the vertical line in the center of the page (div="splitter") disappears and there is no space on the left-hand side the input fields either. Can someone please explain why?
Also, if you guys would not mind how does my css code look? Is it correct?
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
* :focus {
outline: none;
}
body {
background-color: #ced4da;
font-family: sans-serif;
}
.wrapper {
height: 100vh;
display: flex;
}
.login-form {
flex: 1;
justify-content: flex-end;
display: flex;
}
.login-form input[type="email"],
input[type="password"] {
border: none;
background: white;
height: 40px;
padding-left: 60px;
margin-bottom: 10px;
width: 100%;
}
.login-form input[type="submit"] {
border: none;
background-color: #3DBB96;
color: white;
outline: none;
height: 40px;
font-size: 15px;
width: 300px;
font-weight: lighter;
}
form {
align-self: center;
}
.splitter {
background-color: grey;
width: 0.5px;
height: 180px;
align-self: center;
margin-right: 40px;
margin-left: 50px;
}
.side-text {
flex: 1;
align-self: center;
line-height: 30px;
}
.side-text h2 {
font-weight: normal;
}
.side-text p {
font-weight: lighter;
}
<div class="wrapper">
<div class="login-form">
<form action="Login.php" method="POST">
<div class="email-input-field">
<input type="email" placeholder="Email" name="emailPost">
</div>
<div class="password-input-field">
<input type="password" placeholder="Password" name="passwordPost">
</div>
<div class="submit-button">
<input type="submit" value="Submit">
</div>
</form>
</div>
<div class="splitter"></div>
<div class="side-text">
<h2>Cold Ops</h2>
<p>ADMINISTRATION PANEL</p>
</div>
</div>
You have 0.5px width on your splitter. I tried brining it up to 1px, but saw that it did not help. What did seem to work was setting min-width to 1px as well.
Your css looks OK, but I would suggest looking more into how flex-box works, here is a good article: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
The reason why there is no space on the left side is because you have not set any. Did you perhaps mean to set the margin-left to something instead of padding-left?
Perhaps it happens due to flexbox. I made it work via border. Now it works as expected since border isn't affected by possible dynamic width.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
* :focus {
outline: none;
}
body {
background-color: #ced4da;
font-family: sans-serif;
}
.wrapper {
height: 100vh;
display: flex;
}
.login-form {
flex: 1;
justify-content: flex-end;
display: flex;
}
.login-form input[type="email"],
input[type="password"] {
border: none;
background: white;
height: 40px;
padding-left: 60px;
margin-bottom: 10px;
width: 100%;
}
.login-form input[type="submit"] {
border: none;
background-color: #3DBB96;
color: white;
outline: none;
height: 40px;
font-size: 15px;
width: 300px;
font-weight: lighter;
}
form {
align-self: center;
}
.splitter {
background-color: grey;
border-left: 1px solid black;
height: 180px;
align-self: center;
margin-right: 40px;
margin-left: 50px;
}
.side-text {
flex: 1;
align-self: center;
line-height: 30px;
}
.side-text h2 {
font-weight: normal;
}
.side-text p {
font-weight: lighter;
}
<div class="wrapper">
<div class="login-form">
<form action="Login.php" method="POST">
<div class="email-input-field">
<input type="email" placeholder="Email" name="emailPost">
</div>
<div class="password-input-field">
<input type="password" placeholder="Password" name="passwordPost">
</div>
<div class="submit-button">
<input type="submit" value="Submit">
</div>
</form>
</div>
<div class="splitter"></div>
<div class="side-text">
<h2>Cold Ops</h2>
<p>ADMINISTRATION PANEL</p>
</div>
</div>

Resources