Can't unstick button from textarea - html

I have a problem with a contact form I'm making. There are two left floating columns with "name" and "email" in one, then "message" in the other. I want my button to be below the two columns and be centered within the form.
My problem is that, when it's less then 50%, the button sticks to the "message". Even though its parent is the form, the button wants to style itself with the "message" column.
Here is a link to my problem in jsfiddle.
Here's my HTML:
<form id="ajax-contact" method="post" action="mailer.php">
<div class="column">
<label for="name">name</label>
<input type="text" id="name" name="name" required>
<label for="email">email address</label>
<input type="email" id="email" name="email" required>
</div>
<div class="column">
<label for="message">message</label>
<textarea id="message" required></textarea>
</div>
<button id="bottom-button" type="submit">Send</button>
</form>
And my CSS:
form {
padding: 0 5% 0 5%; }
form .column {
width: 100%; }
form label {
display: block;
font-family: "Lato", sans-serif;
font-weight: 400;
color: #553445;
font-size: 1.5em;
line-height: 1em;
padding: 0 5px 5px 2px;
font-size: 1.1em;
text-transform: uppercase;
letter-spacing: 1px; }
form input, form textarea {
display: block;
font-family: "Lato", sans-serif;
font-weight: 300;
font-size: 1.5em;
line-height: 1em;
padding: 5px 10px;
color: #553445;
width: 100%;
background: rgba(85, 52, 69, 0.1);
border: none;
border-bottom: 3px solid rgba(85, 52, 69, 0.4);
outline: none; }
form input:active, form input:focus, form textarea:active, form textarea:focus {
border-bottom: 3px solid #fff; }
form input {
margin-bottom: 40px; }
form textarea {
min-height: 200px;
resize: none; }
button {
background: #e85657;
color: #fff;
padding: 0.5em;
font-family: "Lato", sans-serif;
font-weight: 400;
font-size: 1.5em;
padding-left: 1.05em;
padding-right: 1.05em;
cursor: pointer;
margin-bottom: 3em;
border-radius: 3px;
border: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
transition: all 0.2s ease; }
button:hover {
background: #fff;
color: #e85657; }
button:focus {
outline: none; }
button a {
color: inherit; }
#bottom-button {
width: 100%;
border-radius: 0 0 3px 3px; }
#media screen and (min-width: 30em) {
#ajax-contact .column {
float: left;
width: 50%; }
#ajax-contact textarea {
min-height: 146px; }
#ajax-contact #bottom-button {
border-radius: 3px;
width: auto; } }

Your button wasn't part of the styled div, <div class="column">.
See updated JSFiddle here: http://jsfiddle.net/b9rp3Ls4/6/
EDIT: Based on the comment, I've centered it using this resource from the W3C, available here: http://www.w3.org/Style/Examples/007/center.en.html
The new JS Fiddle: http://jsfiddle.net/b9rp3Ls4/7/
It's better to use the same parent if you're trying to center within. Use the margins to put it right in the middle.

Related

Why is the placeholder font different and the submit button have additional text in Firefox?

The font of the placeholders for the inputs for a form are different in Firefox and I'm trying to figure out why that is and what could be causing that. Why does the submit button have some additional text as well in Firefox
This is how it's supposed to look (Chrome):
And this is how it looks on Firefox:
Here is my code:
HTML:
<form class="form appear appear-hidden" method="post">
<h1>Contact Me</h1>
<div class="name-section">
<input name="name" type="name" placeholder="Name" required />
<input name="surname" type="surname" placeholder="Surname" required />
</div>
<input name="email" type="email" placeholder="Email" required />
<textarea
name = "message"
type="message"
placeholder="Message"
row="4"
required
></textarea>
<input class="submit" type="submit" placeholder="submit" />
</form>
CSS:
form {
width: 70%;
margin: auto;
padding: 100px;
color: white;
}
form h1 {
margin: 5px;
}
.name-section input {
width: 48%;
margin: 5px;
border: 2px solid white;
padding: 10px;
background-color: transparent;
font-weight: 600;
}
form input {
width: 98%;
margin: 5px;
border: 2px solid white;
padding: 10px;
/* background-color: #000; */
background-color: transparent;
font-weight: 600;
color: white;
font-family: 'Poppins', sans-serif;
}
form input:-webkit-autofill,
form input:-webkit-autofill:hover,
form input:-webkit-autofill:focus,
form input:-webkit-autofill:active {
-webkit-text-fill-color: white !important;
transition: background-color 5000s ease-in-out 0s;
font-family: 'Poppins', sans-serif;
}
.submit {
width: 10%;
padding: 5px;
text-align: center;
font-family: 'Poppins', sans-serif;
color: white;
/* background-color: #000; */
background-color: transparent;
font-weight: 600;
cursor: pointer;
-webkit-appearance: none;
}
input::placeholder {
font-family: 'Poppins', sans-serif;
color: white;
font-weight: 600;
}
form input:focus {
outline: none;
}
textarea {
min-height: 100px;
background-color: transparent;
color: white;
font-family: 'Poppins', sans-serif;
width: 98%;
margin: 5px;
border: 2px solid white;
resize: none;
font-weight: 600;
padding: 10px;
}
textarea:focus {
outline: none;
}
textarea::placeholder {
color: white;
margin: 10px;
font-weight: 600;
}
.submit:hover {
color: #000;
background-color: white;
transition: 0.3s ease-in;
}
An <input type="submit"> with no explicit value (read: "label") attribute will have a default value chosen by the user agent. For Chrome, it is "Submit", Firefox is "Submit Query". To be consistent, explicitly set "value":
<input type="submit" value="Submit">
The placeholder color is coming through correctly, but Firefox sets placeholder opacity to 0.54 by default. To be consistent, explicitly set opacity:
input::placeholder, textarea::placeholder {
opacity: 1;
color: #fff;
}
Try adding this to input::placeholder and textarea::placeholder:
.input::-moz-placeholder {
color: #FFFFFF; opacity: 1;
}
.input:-moz-placeholder {
color:#FFFFFF; opacity: 1;
}
As for the submit button having extra text, I can't really see any reason for that. Maybe try closing and reopening the firefox preview window?

Contact form is not responsive to the rest of the page

I have been trying to figure out how to make the contact form on my website responsive so it can be properly adjusted when checking the page on phone.
Here is the website:
https://ddahkickz.com/pages/contact-us
Password: ddah
I have little knowledge regarding this and need assistance if possible. Below you can check the code of the Shopify page. Thank you in advance for the assistance on the matter.
{{ form.errors | default_errors }}
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>contact form</title>
</head>
<body>
<center>
<link href="contact-form.css" rel="stylesheet">
<center><h1 style="font-size:2vw">CONTACT US</h1></center>
<div class="fcf-body">
<div id="fcf-form">
<div class="fcf-form-group">
<label for="First Name" class="fcf-label">First Name</label>
<div class="fcf-input-group">
<input type="text" id="Name" name="Name" class="fcf-form-control" required>
</div>
</div>
<div class="fcf-form-group">
<label for="Last Name" class="fcf-label">Last Name</label>
<div class="fcf-input-group">
<input type="text" id="Name" name="Name" class="fcf-form-control" required>
</div>
</div>
<div class="fcf-form-group">
<label for="Email" class="fcf-label">Your email address</label>
<div class="fcf-input-group">
<input type="email" id="Email" name="contact[email]" class="fcf-form-control" required>
</div>
</div>
<div class="fcf-form-group">
<label for="Message" class="fcf-label">Your message</label>
<div class="fcf-input-group">
<textarea id="Message" name="contact[body]" class="fcf-form-control" rows="6" maxlength="3000" required></textarea>
</div>
</div>
<div class="fcf-form-group">
<button type="submit" id="fcf-button" class="fcf-btn fcf-btn-primary fcf-btn-lg fcf-btn-block">Send Message</button>
</div>
</form>
</center>
</div>
<p></p>
<p></p>
<p></p>
<p></p>
</div>
</body>
</html>
<style>
#fcf-form {
display:block;
}
.fcf-body {
margin: 0;
font-family: -apple-system, Arial, sans-serif;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
text-align: left;
background-color: #fff;
padding: 30px;
padding-bottom: 10px;
border: 1px solid #ced4da;
border-radius: 0.25rem;
max-width: 35%;
}
.fcf-form-group {
margin-bottom: 1rem;
}
.fcf-input-group {
position: relative;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-ms-flex-align: stretch;
align-items: stretch;
width: 100%;
}
.fcf-form-control {
display: block;
width: 100%;
height: calc(1.5em + 0.75rem + 2px);
padding: 0.375rem 0.75rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
outline: none;
border-radius: 0.25rem;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.fcf-form-control:focus {
border: 1px solid #313131;
}
select.fcf-form-control[size], select.fcf-form-control[multiple] {
height: auto;
}
textarea.fcf-form-control {
font-family: -apple-system, Arial, sans-serif;
height: auto;
}
label.fcf-label {
display: inline-block;
margin-bottom: 0.5rem;
}
.fcf-credit {
padding-top: 10px;
font-size: 0.9rem;
color: #545b62;
}
.fcf-credit a {
color: #545b62;
text-decoration: underline;
}
.fcf-credit a:hover {
color: #0056b3;
text-decoration: underline;
}
.fcf-btn {
display: inline-block;
font-weight: 400;
color: #212529;
text-align: center;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: transparent;
border: 1px solid transparent;
padding: 0.375rem 0.75rem;
font-size: 1rem;
line-height: 1.5;
border-radius: 0.25rem;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
#media (prefers-reduced-motion: reduce) {
.fcf-btn {
transition: none;
}
}
.fcf-btn:hover {
color: #212529;
text-decoration: none;
}
.fcf-btn:focus, .fcf-btn.focus {
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
.fcf-btn-primary {
color: #fff;
background-color: #000000;
border-color: #000000;
}
.fcf-btn-primary:hover {
color: #fff;
background-color: #000000;
border-color: #000000;
}
.fcf-btn-primary:focus, .fcf-btn-primary.focus {
color: #fff;
background-color: #000000;
border-color: #000000;
box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.5);
}
.fcf-btn-lg, .fcf-btn-group-lg>.fcf-btn {
padding: 0.5rem 1rem;
font-size: 1.25rem;
line-height: 1.5;
border-radius: 0.3rem;
}
.fcf-btn-block {
display: block;
width: 100%;
}
.fcf-btn-block+.fcf-btn-block {
margin-top: 0.5rem;
}
input[type="submit"].fcf-btn-block, input[type="reset"].fcf-btn-block, input[type="button"].fcf-btn-block {
width: 100%;
}
</style>
{% endform %} ```
Depending what width the form should be in mobile view, the media query is how you can make your application responsive. Here is an example of writing a media query for a small viewport. You can adjust the widths to how you want the form styled.
#media only screen and (max-width: 600px) {
.fcf-form {
max-width: //width you want the form to be;
}
}

Change the color of pop up menu's button

I am new to css so I cannot figure out the way of changing the color of pop up menus two buttons (Submit and Reset). Both of these are placed at the end of the pop up menu, but are not readable because of the color. I have used this code from this site and here the color of button is teal but in my code the button and text color is white and because of this I am unable to read the buttons.
I have tried changing the background color, text color in css but nothing is working
image
Current Image
Current image
I expect the button to be blue
```
.gbtn{
background: #d0d0d0;
color: #444444;
padding: 0 15px;
text-transform: uppercase;
height: 40px;
line-height: 40px;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
font-size: 12px;
}
.gbtn.btn-estimate{
padding:0 22px;
margin-top:7px;
}
.gbtn.btn-discount{
padding:0 26px;
}
.gbtn:hover{
background: #fbc443;
color: #25BCE9;
}
.gbtn:hover span{
color: #25BCE9;
}
.gbtn span{
display: inline-block;
}
button{
/* border:none;
background: #25BCE9;
color: #fff;
display: flex;
justify-content: flex-start;*/
}
#contactForm {
display: none;
z-index: 10000;
border: 3px solid #25BCE9;
padding: 2em;
width: 400px;
text-align: center;
background: #fff;
position: fixed;
top:50%;
left:50%;
transform: translate(-50%,-50%);
-webkit-transform: translate(-50%,-50%)
}
input{
height: 40px;
margin: .8em auto;
font-family: inherit;
text-transform: inherit;
font-size: inherit;
display: block;
width: 280px;
padding: .4em;
}
textarea {
height: 80px;
width:337px;
margin-right: 5px;
margin-bottom: 5px;
font-family: inherit;
text-transform: inherit;
font-size: inherit;
display: block;
padding: .4em;
resize: none;}
.formBtn {
display: inline-block;
background: teal;
color: #fff;
width: 140px;
font-weight: 100;
font-size: 1.2em;
padding: 5px 0;
border: none;
}
<div class="block-currency">
<div class="gbtn btn-estimate">
<div id="contact">Get Quote</div>
</div>
<div id="contactForm">
<h1>Keep in touch!</h1>
<small>We'll get back to you as quickly as possible</small>
<form action="#">
<input placeholder="Name" type="text" required />
<input placeholder="Email" type="email" required />
<input placeholder="Subject" type="text" required />
<textarea placeholder="Comment"></textarea>
<input class="formBtn" type="submit" />
<input class="formBtn" type="reset" />
</form>
</div>
</div>
Block Currency Code
.block-currency{
position:relative;
float:right;
cursor:pointer;
line-height:50px;
height:50px;
}
.block-currency:hover ul{
visibility:visible;
top:50px;
opacity:1;
transition: all 0.3s;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-o-transition: all 0.3s;
}
```
.gbtn{
background: #d0d0d0;
color: #444444;
padding: 0 15px;
text-transform: uppercase;
height: 40px;
line-height: 40px;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
font-size: 12px;
}
.gbtn.btn-estimate{
padding:0 22px;
margin-top:7px;
}
.gbtn.btn-discount{
padding:0 26px;
}
.gbtn:hover{
background: #fbc443;
color: #25BCE9;
}
.gbtn:hover span{
color: #25BCE9;
}
.gbtn span{
display: inline-block;
}
button{
/* border:none;
background: #25BCE9;
color: #fff;
display: flex;
justify-content: flex-start;*/
}
#contactForm {
z-index: 10000;
border: 3px solid #25BCE9;
padding: 2em;
width: 400px;
text-align: center;
background: #fff;
position: relative;
top:0%;
left:0%;
}
input{
height: 40px;
margin: .8em auto;
font-family: inherit;
text-transform: inherit;
font-size: inherit;
display: block;
width: 280px;
padding: .4em;
}
textarea {
height: 80px;
width:337px;
margin-right: 5px;
margin-bottom: 5px;
font-family: inherit;
text-transform: inherit;
font-size: inherit;
display: block;
padding: .4em;
resize: none;}
.formBtn {
display: inline-block;
background: teal;
color: #fff;
width: 140px;
font-weight: 100;
font-size: 1.2em;
padding: 5px 0;
border: none;
}
<div class="block-currency">
<div class="gbtn btn-estimate">
<div id="contact">Get Quote</div>
</div>
<div id="contactForm">
<h1>Keep in touch!</h1>
<small>We'll get back to you as quickly as possible</small>
<form action="#">
<input placeholder="Name" type="text" required />
<input placeholder="Email" type="email" required />
<input placeholder="Subject" type="text" required />
<textarea placeholder="Comment"></textarea>
<input class="formBtn" type="submit" />
<input class="formBtn" type="reset" />
</form>
</div>
</div>
The quickest and easiest way is to add IDs to the input elements:
<input id="submitButton"class="formBtn" type="submit" />
<input id="resetButton"class="formBtn" type="reset" />
and change their color by targeting directly:
#submitButton {
background: blue;
}
#resetButton {
background: blue;
}

textarea:valid + label doesn't work correctly when on a server

I am trying to create some label text on a contact form that when the contact form is the :focus or it is :valid, the text moves above the input box and stays there.
Everything works fine on my local machine (Using brackets live preview), however, whenever I put the code onto my website for some reason the textarea label doesn't move anymore?
Has anybody got any idea why this is?
Here is the full code:
<div class="section">
<div class="wrapper">
<div class="content">
<h2>Contact Me</h2>
<form action="contactme.php" method="post" class="contact-form">
<div class="input-field">
<input type="text" name="name" required="">
<label for="">Full Name</label>
</div>
<div class="input-field">
<input type="text" name="cname" required="">
<label for="">Company Name</label>
</div>
<div class="input-field">
<input type="text" name="website" required="">
<label for="">Current Website (N/A if None)</label>
</div>
<div class="input-field">
<input type="email" name="mail" required="">
<label for="">E-Mail</label>
</div>
<div class="input-field">
<textarea name="message" rows="5" required=""></textarea>
<label for="">Message</label>
</div>
<input type="submit" name="submit" value="Submit Message" class="btn">
</form>
</div>
</div>
</div>
-
body {
margin: 0;
padding: 0;
font-family: 'Roboto Condensed', sans-serif;
width: 100%;
height: 100vh;
background: linear-gradient(to bottom, rgba(0, 142, 204, 5) 50%, rgba(253, 165, 15, 5) 50%);
}
.wrapper {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 600px;
padding: 40px;
box-sizing: border-box;
background: #FFF;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
animation: fadeIn 2s 0s linear;
}
.wrapper h2 {
color: #666;
margin: 0;
padding: 0;
text-align: center;
font-size: 30px;
text-transform: uppercase;
}
.input-field {
position: relative;
width: 100%;
margin-top: 50px;
}
.input-field input,
.input-field textarea {
font-family: 'Roboto Condensed', sans-serif;
width: 100%;
padding: 5px 0;
box-sizing: border-box;
background: transparent;
border: none;
outline: none;
border-bottom: 2px solid #666;
font-size: 16px;
color: #666;
font-weight: 700;
text-transform: uppercase;
resize: none;
}
.input-field label {
position: absolute;
top: 0;
left: 0;
padding: 5px 0;
pointer-events: none;
font-size: 16px;
color: #666;
font-weight: 700;
transition: .5s;
}
.input-field input:focus + label,
.input-field textarea:focus + label,
.input-field input:valid + label,
.input-field textarea:valid + label {
top: -25px;
font-size: 14px;
padding: 2px 5px;
background: #FF006A;
color: #FFF;
border-radius: 4px;
}
.btn {
font-family: 'Roboto Condensed', sans-serif;
margin-top: 20px;
background: linear-gradient(to right, #ff9966, #ff5e62);
color: #FFF;
padding: 15px 30px;
border: none;
outline: none;
border-radius: 30px;
font-size: 16px;
float: right;
transition: all .5s;
}
.btn:hover {
cursor: pointer;
}
#media(max-width: 580px) {
.wrapper {
width: 250px;
padding: 20px;
}
.wrapper h2 {
font-size: 15px;
}
.input-field input,
.input-field textarea {
font-size: 12px;
}
.input-field label {
font-size: 12px;
}
.btn {
font-size: 12px;
}
}

space between buttons to fit page size

Is it possible to have the 3 buttons below spaced to fit any size page? I want to keep the same button size, just making the space between the buttons larger or smaller depending on the screen size. Anything, helps.
#import url(https://fonts.googleapis.com/css?family=Roboto:400,300,600,400italic);
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
.container {
width: 100%;
margin: 0 auto;
position: relative;
}
#contact input[type="text"],
#contact input[type="email"],
#contact input[type="tel"],
#contact input[type="url"],
#contact textarea,
#contact button[type="submit"] {
font: 400 12px/16px "Roboto", Helvetica, Arial, sans-serif;
}
#contact {
background: #F9F9F9;
padding: 25px;
margin: 150px 0;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
}
#contact h3 {
display: block;
font-size: 30px;
font-weight: 300;
margin-bottom: 10px;
}
#contact h4 {
margin: 5px 0 15px;
display: block;
font-size: 13px;
font-weight: 400;
}
.fieldset {
border: medium none !important;
margin: 0 0 10px;
min-width: 100%;
padding: 0;
width: 100%;
}
#contact input[type="text"],
#contact input[type="email"],
#contact input[type="tel"],
#contact input[type="url"],
#contact textarea {
width: 100%;
border: 1px solid #ccc;
background: #FFF;
margin: 0 0 5px;
padding: 10px;
}
#contact input[type="text"]:hover,
#contact input[type="email"]:hover,
#contact input[type="tel"]:hover,
#contact input[type="url"]:hover,
#contact textarea:hover {
-webkit-transition: border-color 0.3s ease-in-out;
-moz-transition: border-color 0.3s ease-in-out;
transition: border-color 0.3s ease-in-out;
border: 1px solid #aaa;
}
#contact textarea {
height: 100px;
max-width: 100%;
resize: none;
}
#contact button[type="submit"] {
cursor: pointer;
width: 100%;
border: none;
background: #4CAF50;
color: #FFF;
margin: 0 0 5px;
padding: 10px;
font-size: 15px;
}
#contact button[type="submit"]:hover {
background: #43A047;
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
transition: background-color 0.3s ease-in-out;
}
#contact button[type="submit"]:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
.copyright {
text-align: center;
}
#contact input:focus,
#contact textarea:focus {
outline: 0;
border: 1px solid #aaa;
}
::-webkit-input-placeholder {
color: #888;
}
:-moz-placeholder {
color: #888;
}
::-moz-placeholder {
color: #888;
}
:-ms-input-placeholder {
color: #888;
}
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 13px;
font-size: 16px;
width:125px;
border: none;
cursor: pointer;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
<div class="container">
<form id="contact" action="" method="post">
<h3>Form</h3>
<h4>Contact us</h4>
<fieldset class="fieldset">
<div class="dropdown">
<button class="dropbtn">Location</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Category</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Sub-Category</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your name" type="text" tabindex="1" required autofocus>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your Email Address" type="email" tabindex="2" required>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your Phone Number (optional)" type="tel" tabindex="3" required>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your Web Site (optional)" type="url" tabindex="4" required>
</fieldset>
<fieldset class="fieldset">
<textarea placeholder="Type your message here...." tabindex="5" required></textarea>
</fieldset>
<fieldset class="fieldset">
<button name="submit" type="submit" id="contact-submit" data-submit="...Sending">Submit</button>
</fieldset>
</form>
</div>
Yes, you can use this below in .fieldset
display: flex;
justify-content: space-between;
Snippet
#import url(https://fonts.googleapis.com/css?family=Roboto:400,300,600,400italic);
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
.container {
width: 100%;
margin: 0 auto;
position: relative;
}
#contact input[type="text"],
#contact input[type="email"],
#contact input[type="tel"],
#contact input[type="url"],
#contact textarea,
#contact button[type="submit"] {
font: 400 12px/16px "Roboto", Helvetica, Arial, sans-serif;
}
#contact {
background: #F9F9F9;
padding: 25px;
margin: 150px 0;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
}
#contact h3 {
display: block;
font-size: 30px;
font-weight: 300;
margin-bottom: 10px;
}
#contact h4 {
margin: 5px 0 15px;
display: block;
font-size: 13px;
font-weight: 400;
}
.fieldset {
border: medium none !important;
margin: 0 0 10px;
min-width: 100%;
padding: 0;
width: 100%;
display: flex;
justify-content: space-between;
}
#contact input[type="text"],
#contact input[type="email"],
#contact input[type="tel"],
#contact input[type="url"],
#contact textarea {
width: 100%;
border: 1px solid #ccc;
background: #FFF;
margin: 0 0 5px;
padding: 10px;
}
#contact input[type="text"]:hover,
#contact input[type="email"]:hover,
#contact input[type="tel"]:hover,
#contact input[type="url"]:hover,
#contact textarea:hover {
-webkit-transition: border-color 0.3s ease-in-out;
-moz-transition: border-color 0.3s ease-in-out;
transition: border-color 0.3s ease-in-out;
border: 1px solid #aaa;
}
#contact textarea {
height: 100px;
max-width: 100%;
resize: none;
}
#contact button[type="submit"] {
cursor: pointer;
width: 100%;
border: none;
background: #4CAF50;
color: #FFF;
margin: 0 0 5px;
padding: 10px;
font-size: 15px;
}
#contact button[type="submit"]:hover {
background: #43A047;
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
transition: background-color 0.3s ease-in-out;
}
#contact button[type="submit"]:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
.copyright {
text-align: center;
}
#contact input:focus,
#contact textarea:focus {
outline: 0;
border: 1px solid #aaa;
}
::-webkit-input-placeholder {
color: #888;
}
:-moz-placeholder {
color: #888;
}
::-moz-placeholder {
color: #888;
}
:-ms-input-placeholder {
color: #888;
}
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 13px;
font-size: 16px;
width: 125px;
border: none;
cursor: pointer;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
<div class="container">
<form id="contact" action="" method="post">
<h3>Form</h3>
<h4>Contact us</h4>
<fieldset class="fieldset">
<div class="dropdown">
<button class="dropbtn">Location</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Category</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Sub-Category</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your name" type="text" tabindex="1" required autofocus>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your Email Address" type="email" tabindex="2" required>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your Phone Number (optional)" type="tel" tabindex="3" required>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your Web Site (optional)" type="url" tabindex="4" required>
</fieldset>
<fieldset class="fieldset">
<textarea placeholder="Type your message here...." tabindex="5" required></textarea>
</fieldset>
<fieldset class="fieldset">
<button name="submit" type="submit" id="contact-submit" data-submit="...Sending">Submit</button>
</fieldset>
</form>
</div>
Just modify these declarations :
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 13px;
font-size: 16px;
width:125px;
border: none;
cursor: pointer;
display:block;
margin: 0 auto;
}
.dropdown {
position: relative;
/*display: inline-block;*/
display:block;
width:33.333333%;
float:left;
}
#import url(https://fonts.googleapis.com/css?family=Roboto:400,300,600,400italic);
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
.container {
width: 100%;
margin: 0 auto;
position: relative;
}
#contact input[type="text"],
#contact input[type="email"],
#contact input[type="tel"],
#contact input[type="url"],
#contact textarea,
#contact button[type="submit"] {
font: 400 12px/16px "Roboto", Helvetica, Arial, sans-serif;
}
#contact {
background: #F9F9F9;
padding: 25px;
margin: 150px 0;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
}
#contact h3 {
display: block;
font-size: 30px;
font-weight: 300;
margin-bottom: 10px;
}
#contact h4 {
margin: 5px 0 15px;
display: block;
font-size: 13px;
font-weight: 400;
}
.fieldset {
border: medium none !important;
margin: 0 0 10px;
min-width: 100%;
padding: 0;
width: 100%;
}
#contact input[type="text"],
#contact input[type="email"],
#contact input[type="tel"],
#contact input[type="url"],
#contact textarea {
width: 100%;
border: 1px solid #ccc;
background: #FFF;
margin: 0 0 5px;
padding: 10px;
}
#contact input[type="text"]:hover,
#contact input[type="email"]:hover,
#contact input[type="tel"]:hover,
#contact input[type="url"]:hover,
#contact textarea:hover {
-webkit-transition: border-color 0.3s ease-in-out;
-moz-transition: border-color 0.3s ease-in-out;
transition: border-color 0.3s ease-in-out;
border: 1px solid #aaa;
}
#contact textarea {
height: 100px;
max-width: 100%;
resize: none;
}
#contact button[type="submit"] {
cursor: pointer;
width: 100%;
border: none;
background: #4CAF50;
color: #FFF;
margin: 0 0 5px;
padding: 10px;
font-size: 15px;
}
#contact button[type="submit"]:hover {
background: #43A047;
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
transition: background-color 0.3s ease-in-out;
}
#contact button[type="submit"]:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
.copyright {
text-align: center;
}
#contact input:focus,
#contact textarea:focus {
outline: 0;
border: 1px solid #aaa;
}
::-webkit-input-placeholder {
color: #888;
}
:-moz-placeholder {
color: #888;
}
::-moz-placeholder {
color: #888;
}
:-ms-input-placeholder {
color: #888;
}
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 13px;
font-size: 16px;
width:125px;
border: none;
cursor: pointer;
display:block;
margin: 0 auto;
}
.dropdown {
position: relative;
/*display: inline-block;*/
display:block;
width:33.333333%;
float:left;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
<div class="container">
<form id="contact" action="" method="post">
<h3>Form</h3>
<h4>Contact us</h4>
<fieldset class="fieldset">
<div class="dropdown">
<button class="dropbtn">Location</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Category</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Sub-Category</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your name" type="text" tabindex="1" required autofocus>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your Email Address" type="email" tabindex="2" required>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your Phone Number (optional)" type="tel" tabindex="3" required>
</fieldset>
<fieldset class="fieldset">
<input placeholder="Your Web Site (optional)" type="url" tabindex="4" required>
</fieldset>
<fieldset class="fieldset">
<textarea placeholder="Type your message here...." tabindex="5" required></textarea>
</fieldset>
<fieldset class="fieldset">
<button name="submit" type="submit" id="contact-submit" data-submit="...Sending">Submit</button>
</fieldset>
</form>
</div>
You can do like this in your CSS:
#media only screen and (max-width: 500px) {
input {
width:100%
}
}