Why are these block elements on the same line? - html

I'm trying to get the two block elements to be on different lines when the browser window is less than 768px. The media query tells the yellow and green divs to be blocks in responsive view, but nothing happens. If you apply the display block to all elements on mobile view, nothing still happens.
I thought block elements were 100% wide and operate on a single row?
#newsletter-wrap {
width: 100%;
height: auto;
background: lightgrey;
float: left;
display: flex;
justify-content: center;
align-items: center;
font-size: 22px;
font-weight: 300;
padding: 25px 25px;
box-sizing: border-box;
}
#newsletter-wrap > *, #newsletter-wrap > form > * {
display: inline;
vertical-align: middle;
}
#newsletter-button {
border: none;
border-radius: 6px;
padding: 10px 20px;
border: 1px solid #333;
cursor: pointer;
}
input {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
#mce-EMAIL {
background: pink;
width: 300px;
height: 25px;
margin: 0 25px;
border: 1px solid #333;
text-align: center;
padding: 4px;
}
#mc-embedded-subscribe-form {
background: green;
width: auto;
text-align: center;
height: auto;
float: left;
}
#newsletter-wrap-text {
background: yellow;
width: auto;
height: auto;
float: left;
}
/* MOBILE */
#media handheld, screen and (max-width: 768px) {
/* BELOW HAS A PROBLEM */
#newsletter-wrap-text, #mc-embedded-subscribe-form {
display: block;
}
}
<section id="newsletter-wrap">
<div id="newsletter-wrap-text">wuf wfbrie erig ergibw eiwbfwe wef00x0 __W)9.</div>
<form action="https://eiurfhyergv.us17.list-manage.com/subscribe/post?u=8c38151fa33f984127db5705c&id=4c741659e1" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<input type="email" placeholder="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
<div id="mce-responses">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
<input type="submit" value="Subscribe" name="subscribe" id="newsletter-button">
</form>
</section>

As you have set display: flex to the parent section container, you have to set flex-direction: column; in order to display the child elements in a column rather than in a row. (or you could just not use display: flex at all and leave the block elements as they are, but I assume that flex is there for a reason like responsiveness or something)
By the way, you could also leave out the float: left as it has no effect in this case. I'd generally advise to clean the CSS up a bit. You are using display: flex;, but then there are the floats and display: inline, which is then again being overwritten by display: block - that's all unnecessary!
#newsletter-wrap {
width: 100%;
height: auto;
background: lightgrey;
float: left;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 22px;
font-weight: 300;
padding: 25px 25px;
box-sizing: border-box;
}
#newsletter-wrap > *, #newsletter-wrap > form > * {
display: inline;
vertical-align: middle;
}
#newsletter-button {
border: none;
border-radius: 6px;
padding: 10px 20px;
border: 1px solid #333;
cursor: pointer;
}
input {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
#mce-EMAIL {
background: pink;
width: 300px;
height: 25px;
margin: 0 25px;
border: 1px solid #333;
text-align: center;
padding: 4px;
}
#mc-embedded-subscribe-form {
background: green;
width: auto;
text-align: center;
height: auto;
float: left;
}
#newsletter-wrap-text {
background: yellow;
width: auto;
height: auto;
float: left;
}
/* MOBILE */
#media handheld, screen and (max-width: 768px) {
/* BELOW HAS A PROBLEM */
#newsletter-wrap-text, #mc-embedded-subscribe-form {
display: block;
}
}
<section id="newsletter-wrap">
<div id="newsletter-wrap-text">wuf wfbrie erig ergibw eiwbfwe wef00x0 __W)9.</div>
<form action="https://eiurfhyergv.us17.list-manage.com/subscribe/post?u=8c38151fa33f984127db5705c&id=4c741659e1" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<input type="email" placeholder="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
<div id="mce-responses">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
<input type="submit" value="Subscribe" name="subscribe" id="newsletter-button">
</form>
</section>

Related

responsive html and css code with any devices

I want to render my screen responsive with any kind of device, so my code display very good on a big screen but not the same thing with the young screen so I want my screen to be fitted for all sizes.I spend a lot of time to target it but I can't found any solution my code:
* {
box-sizing: border-box;
padding: 0%;
margin: 0%;
background-color: #dfe3ee;
}
.text {
float: left;
margin-top: 200px;
margin-left: 160px;
font-size: 2rem;
font-family: sans-serif;
color: rgb(100, 5, 5)
}
form {
border: 3px solid #f1f1f1;
width: 30%;
display: flex;
flex-wrap: wrap;
flex-direction: column;
margin-top: 5rem;
margin-right: 250px;
float: right;
}
input[type=text],
input[type=password] {
width: 90%;
padding: 8px 12px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
background-color: #04AA6D;
color: white;
padding: 8px 10px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
button:hover {
opacity: 0.8;
}
/* Extra style for the cancel button (red) */
/* Center the avatar image inside this container */
.container {
padding: 16px;
}
/* The "Forgot password" text */
span.psw {
float: right;
padding-top: 16px;
}
#media screen and (max-width: 600px) {
span.psw {
display: block;
float: right;
}
.form {
border: 3px solid #f1f1f1;
width: 30%;
display: flex;
}
}
import {Link} from "react-router-dom"; const RegisterPage =() => { return (
<div>
<div className="text">
<h1>Private</h1>
</div>
<form>
<div class="container">
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required />
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required />
<button type="submit">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember" /> Remember me
</label>
</div>
<div className="container" style={{ "backgroundColor": "#f1f1f1"}}>
Forgot password?
<div className="btn">
<button>Create New Account</button>
</div>
</div>
</form>
</div>
) }; export default RegisterPage;
Check this out, I added flexbox for your main div and modified your media query part with flexbox and removed margins. Keep in mind I changed className with class for snipping, for testing in your local you should change them again with className
* {
box-sizing:border-box;
padding: 0%;
margin: 0%;
background-color: #dfe3ee;
}
.mainDiv {
width: 100%;
height: 100vh;
display: flex;
justify-content: space-evenly;
align-items: center;
}
.text{
float: left;
font-size: 2rem;
font-family: sans-serif;
color:rgb(100, 5, 5)
}
form {
border: 3px solid #f1f1f1;
width: 30%;
display: flex;
flex-wrap: wrap;
flex-direction: column;
}
input[type=text], input[type=password] {
width: 90%;
padding: 8px 12px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
background-color: #04AA6D;
color: white;
padding: 8px 10px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
button:hover {
opacity: 0.8;
}
/* Extra style for the cancel button (red) */
/* Center the avatar image inside this container */
.container {
padding: 16px;
}
/* The "Forgot password" text */
span.psw {
float: right;
padding-top: 16px;
}
#media screen and (max-width: 600px) {
.mainDiv {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.text {
margin-left: 0;
}
span.psw {
display: block;
float: right;
}
form{
border: 3px solid #f1f1f1;
width: 30%;
display: flex;
float: none;
margin-right: 0;
min-width: 250px;
}
}
<div class="mainDiv">
<div class="text" >
<h1>Private</h1>
</div>
<form >
<div class="container">
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required />
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required />
<button type="submit">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember" /> Remember me
</label>
</div>
<div className="container" style={{"backgroundColor":"#f1f1f1"}}>
<a href="" >Forgot password?</a>
<div className="btn" >
<button >Create New Account</button>
</div>
</div>
</form>
</div>

How to set div height to equal it div height?

I would like to know how can I adjust the height of a div depending of the content on it. For example, I have the following HTML:
div.Pantalla {
background-image: url("https://cdn.pixabay.com/photo/2015/07/11/23/02/plane-841441_1280.jpg");
background-size: cover;
justify-content: center;
align-items: center;
height: auto;
display: flex;
flex-direction:column;
}
.formulario{
position: relative;
width:80%;
margin:auto;
}
form{
margin-top: 10px;
display: block;
width:100%;
padding:16px;
border: 1px solid black;
border-radius:5px;
background: deepskyblue;
}
.form-inline {
display: flex;
flex-flow: row wrap;
align-items: center;
}
/* Add some margins for each label */
.form-inline label {
margin: 5px 10px 5px 0;
}
/* Style the input fields */
.form-inline input {
vertical-align: middle;
margin: 5px 10px 5px 0;
padding: 10px;
background-color: #fff;
border: 1px solid #ddd;
}
/* Style the submit button */
.form-inline button {
width: 10%;
text-align: center;
padding: 10px 20px;
border: 1px solid #ddd;
background: #0095dd;
background-size: cover;
color: white;
}
.form-inline button:hover {
background-color:lightblue;
}
ul{
width:100%;
padding:16px;
border: 2px solid black;
border-radius:5px;
background: deepskyblue;
margin-top: 10px;
}
li{
position: center;
width:100%;
}
.column {
float: left;
margin-top: 20px;
width: 80%;
margin-right: 10%;
margin-left: 10%;
position: relative;
}
.column button{
margin-right: 10%;
margin-left: 10%;
margin-top: 10px;
width: 80%;
text-align: center;
padding: 10px 20px;
border: 1px solid #ddd;
background: #0095dd;
background-size: cover;
color: white;
}
.column button:hover {
background-color:lightblue;
}
<div class="Pantalla">
<div class="formulario">
<form class="form-inline" [formGroup]="SearchForm">
<input type="text" id="Origin" placeholder="Enter Origin" formControlName="Origin">
<input type="text" id="Destiny" placeholder="Enter Destination" formControlName="Destiny">
<input type="date" id="CheckIn" placeholder="Enter Check-In Date" formControlName="CheckIn">
<input type="date" id="Checkout" placeholder="Enter Check-Out Date" formControlName="Checkout">
<input type="number" id="people" placeholder="Enter Number of People" formControlName="people">
<button type="submit" (click)="getPacks()">Go!</button>
</form>
</div>
<div class="column menu">
<ul class="list-group" *ngFor="let pack of packs; let i = index">
<li class="list-group-item">Flight {{pack.flight.Airline}}, {{pack.flight.LandMarkName_Origin}} - {{pack.flight.LandMarkName_Destination}} for {{pack.flight.minPrice}} Dolars </li>
<li class="list-group-item">Stay at {{pack.hotel.name}}, with {{pack.hotel.Star_rating}} / {{pack.hotel.scale}} Stars</li>
<li class="list-group-item">Visit
<p *ngFor="let places of pack.places; let j = index">{{places.name}}, </p>
</li>
<button>Get it!</button>
</ul>
</div>
</div>
However, when I launch my application, what I get is this:
I want that the height of the "Pantalla" div equals the total height of the divs that it has. How can I achieve this?
UPDATED: When the code is like this, what I get is the following:
enter image description here
The reason why the background only cover to the first div is that you're missing the display rule.
Please add display: flex; and flex-direction:column, then you will see it's working.
div.Pantalla {
background-image: url("https://cdn.pixabay.com/photo/2015/07/11/23/02/plane-841441_1280.jpg");
background-size: cover;
justify-content: center;
align-items: center;
height: auto;
/* Add this */
display: flex;
flex-direction: column;
}
.formulario{
position: relative;
width:80%;
margin:auto;
}
form{
margin-top: 10px;
display: block;
width:100%;
padding:16px;
border: 1px solid black;
border-radius:5px;
background: deepskyblue;
}
.form-inline {
display: flex;
flex-flow: row wrap;
align-items: center;
}
/* Add some margins for each label */
.form-inline label {
margin: 5px 10px 5px 0;
}
/* Style the input fields */
.form-inline input {
vertical-align: middle;
margin: 5px 10px 5px 0;
padding: 10px;
background-color: #fff;
border: 1px solid #ddd;
}
/* Style the submit button */
.form-inline button {
width: 10%;
text-align: center;
padding: 10px 20px;
border: 1px solid #ddd;
background: #0095dd;
background-size: cover;
color: white;
}
.form-inline button:hover {
background-color:lightblue;
}
ul{
width:100%;
padding:16px;
border: 2px solid black;
border-radius:5px;
background: deepskyblue;
margin-top: 10px;
}
li{
position: center;
width:100%;
}
.column {
float: left;
margin-top: 20px;
width: 80%;
margin-right: 10%;
margin-left: 10%;
position: relative;
}
.column button{
margin-right: 10%;
margin-left: 10%;
margin-top: 10px;
width: 80%;
text-align: center;
padding: 10px 20px;
border: 1px solid #ddd;
background: #0095dd;
background-size: cover;
color: white;
}
.column button:hover {
background-color:lightblue;
}
<div class="Pantalla">
<div class="formulario">
<form class="form-inline" [formGroup]="SearchForm">
<input type="text" id="Origin" placeholder="Enter Origin" formControlName="Origin">
<input type="text" id="Destiny" placeholder="Enter Destination" formControlName="Destiny">
<input type="date" id="CheckIn" placeholder="Enter Check-In Date" formControlName="CheckIn">
<input type="date" id="Checkout" placeholder="Enter Check-Out Date" formControlName="Checkout">
<input type="number" id="people" placeholder="Enter Number of People" formControlName="people">
<button type="submit" (click)="getPacks()">Go!</button>
</form>
</div>
<div class="column menu">
<ul class="list-group" *ngFor="let pack of packs; let i = index">
<li class="list-group-item">Flight {{pack.flight.Airline}}, {{pack.flight.LandMarkName_Origin}} - {{pack.flight.LandMarkName_Destination}} for {{pack.flight.minPrice}} Dolars </li>
<li class="list-group-item">Stay at {{pack.hotel.name}}, with {{pack.hotel.Star_rating}} / {{pack.hotel.scale}} Stars</li>
<li class="list-group-item">Visit
<p *ngFor="let places of pack.places; let j = index">{{places.name}}, </p>
</li>
<button>Get it!</button>
</ul>
</div>
</div>
As I can see that you have a main div and two child div inside that main div element
and you want that the background image of must cover both div.
if I am right then change the height of your main element
height: 100vh;
change your css code like below and see what happend
div.Pantalla {
background-image: url("https://cdn.pixabay.com/photo/2015/07/11/23/02/plane-841441_1280.jpg");
background-size: cover;
justify-content: center;
align-items: center;
height: 100vh;
}
If what you want is the image that occupies all the space that its parent has, try this:
I suppose that the div.Pantalla's parent is a div with id: app.
#app {
position: relative;
width: 100%;
height: auto;
}
div.Pantalla {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}

How to achieve two inputs next to each other?

every time when I have to work with Inputs this problem occurs.
My goal is to make a simple input form and achieve that 2 Inputs type number will be the same width, with small space between them in one line, just under "Description" input.
I've tried to add them to divs and apply Display:inline-block to them, but it didn't work. Now I've tried to apply display: flex on it a this is the result. Changing the width of input does not work. Thank you for your help.
.inputBox{
width: 30%;
padding: 2em;
text-align: center;
background-color: white;
border-radius: .3em;
}
.inputBox h3{
font-size: 2em;
font-weight: 300;
}
.inputBox input[type="text"]{
width: 100%;
padding: .5em;
margin: 1em 0;
border-radius: .3em;
border: 1px solid grey;
box-sizing: border-box;
}
.inputBox input[type="number"]{
padding: .5em;
border-radius: .3em;
border: 1px solid grey;
box-sizing: border-box;
width: 100%;
}
label{
display: block;
text-align: left;
}
.flex{
display: flex;
justify-content: space-between;
}
<div className="inputBox">
<h3>Please set your alarm</h3>
<label for="text">Description</label>
<input type="text" id="text" />
<div className="flex">
<div className="inputNumber">
<label>Hours</label>
<input type="number" />
</div>
<div className="inputNumber">
<label>Minutes</label>
<input type="number" />
</div>
</div>
.inputBox{
width: 30%;
padding: 2em;
text-align: center;
background-color: white;
border-radius: .3em;
}
.inputBox h3{
font-size: 2em;
font-weight: 300;
}
.inputBox input[type="text"]{
width: 100%;
padding: .5em;
margin: 1em 0;
border-radius: .3em;
border: 1px solid grey;
box-sizing: border-box;
}
.inputBox input[type="number"]{
padding: .5em;
border-radius: .3em;
border: 1px solid grey;
box-sizing: border-box;
width: 100%;
}
label{
display: block;
text-align: left;
}
.flex{
display: flex;
justify-content: space-between;
}
.inputNumber{
flex-basis:48%;
}
<div class="inputBox">
<h3>Please set your alarm</h3>
<label for="text">Description</label>
<input type="text" id="text" />
<div class="flex">
<div class="inputNumber">
<label>Hours</label>
<input type="number" />
</div>
<div class="inputNumber">
<label>Minutes</label>
<input type="number" />
</div>
</div>
If you want to keep inputBox's width at 30%, you can do something like this:
HTML
<div class="inputBox">
<h3>Please set your alarm</h3>
<label for="text">Description</label>
<input type="text" id="text" />
<div class="flex">
<div class="inputNumber">
<label>Hours</label>
<input type="number" />
</div>
<div class="inputNumber second">
<label>Minutes</label>
<input type="number" />
</div>
</div>
</div>
CSS
.inputBox {
width: 30%;
padding: 2em;
text-align: center;
background-color: white;
border-radius: .3em;
}
.inputBox h3 {
font-size: 2em;
font-weight: 300;
}
.inputBox input[type="text"] {
width: 100%;
padding: .5em;
margin: 1em 0;
border-radius: .3em;
border: 1px solid grey;
box-sizing: border-box;
}
.inputBox input[type="number"] {
padding: .5em;
border-radius: .3em;
border: 1px solid grey;
box-sizing: border-box;
width: 100%;
}
label {
display: block;
text-align: left;
}
.flex {
display: flex;
flex-direction: row;
}
.inputNumber {
width: 50%;
}
.second {
margin-left: 5%;
}
two problems:
you are using className when you should be using class
change .inputBox width to 100%
also, you should ALWAYS try to post a working snippet that shows your problem. You will get back answers faster and ones that are more likely to work!
.inputBox{
width: 100%;
padding: 2em;
text-align: center;
background-color: white;
border-radius: .3em;
}
.inputBox h3{
font-size: 2em;
font-weight: 300;
}
.inputBox input[type="text"]{
width: 100%;
padding: .5em;
margin: 1em 0;
border-radius: .3em;
border: 1px solid grey;
box-sizing: border-box;
}
.inputBox input[type="number"]{
padding: .5em;
border-radius: .3em;
border: 1px solid grey;
box-sizing: border-box;
width: 100%;
}
label{
display: block;
text-align: left;
}
.flex{
display: flex;
justify-content: space-between;
}
<div class="inputBox">
<h3>Please set your alarm</h3>
<label for="text">Description</label>
<input type="text" id="text" />
<div class="flex">
<div class="inputNumber">
<label>Hours</label>
<input type="number" />
</div>
<div class="inputNumber">
<label>Minutes</label>
<input type="number" />
</div>
</div>
you can use display: grid on your parent and modify the first child of grid to span across the first line like:
.parentContainer {
/* this will create the grid for us with 1rem gap between children */
display: grid;
grid-template-columns: repeat(1, 1fr),
grid-gap: 1rem;
}
.theChildElementYouWantToFullWidth {
grid-column: 1 / span 3;
}
for more information check this doc from MDN on Grid styling!

Trouble aligning one of the labels to the right

View problem at:
https://jsfiddle.net/xa3u5w8j/5/
The reason why I want my button div to be flex is it has this CSS:
.button {
background-color: aqua;
text-align: center;
width: 150px;
height: 50px;
cursor: pointer;
display: flex;
}
And thus, removing the flex property will cause its text to mis-align.
I want all 3 labels to be aligned to the right, but it somehow is not working for the 3rd label. Any insight can help! Thanks
EDIT: Code
/* Gives the form left/right margin and sets text color */
.course-info {
margin: 0 20px 0 20px;
color: #9E7772;
}
/* Makes sure the form contents are lined up */
.course-info label {
display: inline-block;
width: 540px;
text-align: right;
margin: 20px 0 20px 0;
align-items: top;
}
/* Styles the input and textarea and make sure they line up */
.course-info input {
width: 400px;
background-color: white;
border-bottom: 3px solid #E0DEDE;
}
.course-info textarea {
word-break: break-all;
width: 394px; /* 400px(intended length) - 2*3px(border width) */
height: 100px;
border: 3px solid #E0DEDE;
display: inline-block;
}
/* Makes sure they don't break into diff lines */
.course-title label, .course-title input{
float: none;
display: inline-block;
}
.invitation-section {
display: flex;
justify-content: right;
}
/* Special length and height */
.invitation-link{
max-width: 250px; /* 400px - button width to align on the right side */
max-height: 20px;
}
.button-wrapper{
display: inline-block;
}
.button {
background-color: aliceblue;
width: 150px;
display: flex; /*This is necessary*/
}
<form class="course-info" onSubmit={handleSettingsChange}>
<label>
Course Title:
<input type="text" value="Whatever is here"/>
</label>
<label>
<span>Description:</span>
<textarea type="text">Random text here</textarea>
</label>
<label>
<div class="invitation-section">
<span>Invitation:</span>
<textarea readOnly
class="invitation-link" type="text">
</textarea>
<label class="button-wrapper">
<div class="button">Button</div>
</label>
</div>
</label>
</form>
label {
display: inline-block;
width: 140px;
text-align: right;
}
.button {
background-color: aqua;
text-align: center;
width: 150px;
height: 50px;
cursor: pointer;
display: flex;
}
.invitation-link {
max-width: 250px;
/* 400px - button width to align on the right side */
max-height: 20px;
}
.block {
margin-bottom: 10px;
}
label {
display: inline-block;
width: 140px;
text-align: right;
}
.button {
background-color: aqua;
text-align: center;
width: 150px;
height: 50px;
cursor: pointer;
display: flex;
}
.invitation-link {
max-width: 250px;
/* 400px - button width to align on the right side */
max-height: 20px;
}
.block {
margin-bottom: 10px;
}
.course-info textarea {
word-break: break-all;
width: 394px; /* 400px(intended length) - 2*3px(border width) */
height: 100px;
border: 3px solid #E0DEDE;
display: inline-block;
}
button {
display: inline-block;
margin-left: 10px;
margin-top:-2px;
background-color: aqua;
width: 80px;
height: 30px;
cursor: pointer;
}
<form class="course-info" onSubmit={handleSettingsChange}>
<div class="block">
<label> Course Title:</label>
<input type="text" value="Whatever is here" />
</div>
<div class="block">
<label>Description:</label>
<textarea type="text">Random text here</textarea>
</div>
<div class="block invitation-section">
<label>Invitation:</label>
<textarea readOnly class="invitation-link" type="text">
</textarea>
<button>
Copy
</button>
</div>
</form>

CSS Flexbox Inputs no responsive

Im new to flexbox and css.I need some help to make this code work.
The problem is the following, i cant make the inputs, textarea and button to be responsive.
I need them to be that width size on normal computer page but to be smaller and responsive on mobile devices.
Any advice with help me.
Thanks a lot
.email{
padding: 0.5% 0% 0.5% 0%;
display: flex;
align-items: center;
flex-flow: column;
}
.email >div{
margin: 10px 0px 10px 0px;
}
input {
padding: 15px;
width: 402px;
max-width: 402px;
box-sizing: border-box;
border: 1px solid #272525;
font-size: small;
}
::placeholder {
font-size: 14px ;
opacity: 1;
}
textarea{
padding: 15px;
width: 402px;
resize: vertical;
font-size: small;
border: 1px solid #272525;
}
.button-send{
width: 434px;
height: 40px;
background-color: black;
color: white;
font-size: 15px;
font-size: small;
}
<div class="email">
<div>
<input type="text" placeholder="Name">
</div>
<div>
<input type="text" placeholder="Email*">
</div>
<div>
<textarea rows="10" placeholder="Message*"></textarea>
</div>
<div>
<button class="button-send">Send </button>
</div>
</div>
you can add #media queries in Css as I have done it for you below:-
Click on Run code snippet and then Full page and make your window smaller and check it
.email {
padding: 0.5% 0% 0.5% 0%;
display: flex;
align-items: center;
flex-flow: column;
}
.email>div {
margin: 10px 0px 10px 0px;
}
input {
padding: 15px;
width: 402px;
max-width: 402px;
box-sizing: border-box;
border: 1px solid #272525;
font-size: small;
}
::placeholder {
font-size: 14px;
opacity: 1;
}
textarea {
padding: 15px;
width: 402px;
resize: vertical;
font-size: small;
border: 1px solid #272525;
}
.button-send {
width: 434px;
height: 40px;
background-color: black;
color: white;
font-size: 15px;
font-size: small;
}
#media only screen and (max-width: 600px) {
input {
width: 200px;
max-width: 200px;
}
textarea {
width: 200px;
max-width: 200px;
}
button {
width: 200px;
max-width: 200px;
}
}
<body>
<div class="email">
<div>
<input type="text" placeholder="Name">
</div>
<div>
<input type="text" placeholder="Email*">
</div>
<div>
<textarea rows="10" placeholder="Message*"></textarea>
</div>
<div>
<button class="button-send">Send </button>
</div>
</div>
</body>
In the event, you need to alter CSS values exclusively for small screen sizes but retain specific values for another screen size you would then need to use media queries.
So first what is a media query?
A media query consists of a media type and zero or more expressions that check for the conditions of particular media features.
https://www.w3.org/TR/css3-mediaqueries/
I'd advise reading through that document to get a better understanding of what media queries really are.
But in answer to your question to have responsive text areas you would want to add in something like this (You could also just use max-width by changing all your widths to 100% and setting your max-width to your current width.);
.email {
padding: 0.5% 0% 0.5% 0%;
display: flex;
align-items: center;
flex-flow: column;
}
.email>div {
margin: 10px 0px 10px 0px;
}
input {
padding: 15px;
width: 402px;
max-width: 402px;
box-sizing: border-box;
border: 1px solid #272525;
font-size: small;
}
::placeholder {
font-size: 14px;
opacity: 1;
}
textarea {
padding: 15px;
width: 402px;
resize: vertical;
font-size: small;
border: 1px solid #272525;
}
.button-send {
width: 434px;
height: 40px;
background-color: black;
color: white;
font-size: 15px;
font-size: small;
}
#media all and (max-width:500px) {
textarea,.button-send,input {
width: 100%;
}
}
<div class="email">
<div>
<input type="text" placeholder="Name">
</div>
<div>
<input type="text" placeholder="Email*">
</div>
<div>
<textarea rows="10" placeholder="Message*"></textarea>
</div>
<div>
<button class="button-send">Send </button>
</div>
</div>