MailChimp Form and Button in the same line - css

On my MailChimp form I would like to have the form and submit the button inline with one another.
I have been trying several different variations of float and display but none of them have the desired effect.
Here is the original code. Anyone have any suggestions on how to align the form and the button?
#mc_embed_signup .button {
clear: both;
background-color: #aaa;
border: 0 none;
border-radius: 4px;
color: #FFFFFF;
cursor: pointer;
display: inline-block;
font-size: 15px;
font-weight: bold;
height: 32px;
line-height: 32px;
margin: 10px 0px 10px 0;
padding: 0 22px;
text-align: center;
text-decoration: none;
vertical-align: top;
white-space: nowrap;
width: auto;
}
#mc_embed_signup .mc-field-group input {
display: block;
width: 100%;
padding: 8px 0;
text-indent: 2%;
}
#mc_embed_signup input.mce_inline_error {
border-color: #6B0505;
}
#mc_embed_signup input {
border: 1px solid #999;
-webkit-appearance: none;
}
#mc_embed_signup .mc-field-group label {
display: block;
margin-bottom: 3px;
}
<!-- Begin MailChimp Signup Form -->
<style type="text/css">
/* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>
<div id="mc_embed_signup">
<form action="//utz-benkel.us10.list-manage.com/subscribe/post?u=9684bbce9ec8413a5614ca7c3&id=116fd11541" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<div class="mc-field-group">
<label for="mce-EMAIL">Email Addresse </label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" placeholder="name#domain.de">
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;"><input type="text" name="b_9684bbce9ec8413a5614ca7c3_116fd11541" tabindex="-1" value=""></div>
<div class="clear text-center"><input type="submit" value="Senden" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</div>
</form>
</div>
<!--End mc_embed_signup-->

In newsletter is recommended use "old style" code, with <table> and inline style. If you use table can have the form next to each other and it will be compatible on most devices.
Live example on the jsFiddle
button {
clear: both;
background-color: #aaa;
border: 0 none;
border-radius: 4px;
color: #FFFFFF;
cursor: pointer;
display: inline-block;
font-size: 15px;
font-weight: bold;
height: 32px;
line-height: 32px;
margin: 10px 0px 10px 0;
padding: 0 22px;
text-align: center;
text-decoration: none;
vertical-align: top;
white-space: nowrap;
width: auto;
}
input {
display: block;
width: 100%;
padding: 8px 0;
text-indent: 2%;
}
<table>
<tr>
<td><input type="text" placeholder="name#name.com" /></td>
<td><button>Send</button></td>
</tr>
</table>

I made some changes to your code for inline elements:
#mc_embed_signup .button {
clear: both;
background-color: #aaa;
border: 0 none;
border-radius: 4px;
color: #FFFFFF;
cursor: pointer;
display: inline-block;
font-size: 15px;
font-weight: bold;
height: 32px;
line-height: 32px;
/*margin: 10px 0px 10px 0;*/
/*padding: 0 22px;*/
text-align: center;
text-decoration: none;
vertical-align: top;
white-space: nowrap;
/*width: auto;*/
}
#mc_embed_signup .mc-field-group input {
/*display: block;*/
/*width: 100%;*/
/*padding: 8px 0;*/
text-indent: 2%;
}
#mc_embed_signup input.mce_inline_error {
border-color: #6B0505;
}
#mc_embed_signup input {
border: 1px solid #999;
-webkit-appearance: none;
}
#mc_embed_signup .mc-field-group label {
display: block;
margin-bottom: 3px;
}
#mce-EMAIL{
padding: 8px 0;
display: inline-block;
width: 70%;
}
#mc-embedded-subscribe{
display: inline-block;
width: 20%;
margin: 0;
padding: 0;
}
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="//utz-benkel.us10.list-manage.com/subscribe/post?u=9684bbce9ec8413a5614ca7c3&id=116fd11541" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<div class="mc-field-group">
<label for="mce-EMAIL">Email Addresse </label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" placeholder="name#domain.de">
<input type="submit" value="Senden" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;"><input type="text" name="b_9684bbce9ec8413a5614ca7c3_116fd11541" tabindex="-1" value=""></div>
<div class="clear text-center"></div>
</div>
</form>
</div>
<!--End mc_embed_signup-->
http://jsfiddle.net/mitsuru/3Lusbvjx/1/
You should put the submit input near the email from input, then "inline-block" and "width" in % do the magic.
It doesn't use tables, !importants, nor needs to fix or apply tricks. It's just CSS.
Cheers.

Related

set a divs besdie each other in a table reactjs

Im building a website that is like an airport booking's website
it has this table
i don't know how can I style it as shown in the photo
this is what I did
<div className="section>">
<div className="content">
<div className="container">
<div className="row">
<div className="planner">
<form>
<div className="checkbox">
<div className="row">
<label>
<input
className="checkbox-round"
type="checkbox"
defaultChecked={checked}
onChange={() => setChecked(!checked)}
/>
Türkiye'den Gönder
</label>
</div>
<label>
<input
className="checkbox-round"
type="checkbox"
defaultChecked={!checked}
onChange={() => setChecked(!checked)}
/>
Türkiye'ye Getir
</label>
</div>
<div className="form">
<div className="row">
<label htmlFor="">Kurye Taşıması</label>
<label> Nereye</label>
</div>
<div className="row">
<select>
<option value="">Almanya</option>
<option value=""></option>
</select>
</div>
<div className="labels">
<div className="inputs">
<label>AĞRILIK</label>
<input type="weight" placeholder="KG" />
<label>UZUNLUK</label>
<input type="height" placeholder="CM" />
<label>CENSLIK</label>
<input type="height" placeholder="CM" />
<label> YUKSELIK</label>
<input type="height" placeholder="CM" />
</div>
</div>
<div className="row">
<div className="total">
<h2>ODENECEK TUTAR</h2>
</div>
<button>DEVAM ET</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</>
);
};
and this is the CSS file
.checkbox{
margin: 0px 5px 0px 0px;
padding: 10px;
align-items: center;
justify-content: center;
}
.checkbox-round {
display: inline-block;
width: 1.3em;
height: 1.3em;
background-color: white;
border-radius: 50%;
vertical-align: middle;
border: 1px solid #ddd;
-webkit-appearance: none;
outline: none;
cursor: pointer;
}
body{
overflow: hidden;
background-color: #2a3541 !important;
}
.dot{
color: rgb(236, 5, 5);
}
.container{
max-width: 100%;
margin: 0;
padding: 0;
background-color: #2a3541;
} .planner{
margin: 22px 200px 20px 20px !important;
border:2px #ddd;
border-radius:10px;
background-color: #f1f1f1;
padding: 1rem;
margin: 0;
max-width: 100%;
}
.row{
float: right;
width: 40%;
display: inline-flex;
flex-direction: row;
}
.inputs{
display: inline;
max-height:100%;
max-width: 100%;
margin: 0;
padding: 0;
border: none;
background-color: #f1f1f1;
border-radius: 10px;
color: #2a3541;
}
.labels{
display: block;
}
div label{
display:block;
}
so basically, what I can't figure out is how to put the inputs beside each other just like the given photo with saving the positions of other divs

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>

Html5 form validation dont display error with data slide

I have a form validation using the html5, but when the form is inside a certain div, the validation doesnt work.
The div:
div class="slide story" id="slide-6" data-slide="6">
...
</div>
If the form is out of this div it works fine! But when this div surround the form the validation doens't work.
The Css:
#slide-6 {
background-color: #00387F;
color: #e4e6e5;
padding-bottom: 350px;
padding-top: 90px;
}
.contact-info .contact-content{
margin-bottom: 30px;
}
.contact-info p{
margin-bottom: 20px;
}
.contact-info p i{
font-size: 16px;
margin-right: 10px;
}
.contact-form{}
.contact-form input[type="text"],
.contact-form input[type="email"]{
border: 1px solid #E8E8E8;
padding: 8px 14px;
width: 100%;
margin-bottom: 20px;
}
.contact-form textarea{
border: 1px solid #E8E8E8;
padding: 8px 14px;
width: 100%;
margin-bottom: 20px;
}
#media (max-width: 767px) {
#slide-6 {
background-image: none;
}
}
#slide-6 .line-row .hr {
background-color: #FFFFFF;
color: #FFFFFF;
}
#slide-6 a {
color: inherit;
outline: none;
text-decoration: none;
}
#media (max-width: 767px) {
.with-hover-text{
margin-bottom: 2em;
margin-top: 1em;
}
}
#contact-row-4 {
padding-top: 125px;
}
#contact-row-4 .col-12 {
height: 175px;
overflow: hidden;
padding-top: 20px;
transition: all ease-in .5s;
}
#contact-row-4 img {
display: block;
margin: 0 auto;
max-height: 100%;
max-width: 100%;
}
#contact-row-4 .col-12:hover {
height: 175px;
padding-top: 0;
}
#contact-row-4 .col-12 .hover-text {
display: none;
font-size: 20px;
}
The form:
<div class="slide story" id="slide-6" data-slide="6">
<div class="col-sm-7 col-sm-offset-1">
<form action="php/send-contact.php" class="contact-form" name="contact-form" method="post">
<div class="row">
<div class="col-sm-6">
<input type="text" name="name" required="required" placeholder="Name*">
</div>
<div class="col-sm-6">
<input type="email" name="email" required="required" placeholder="Email*">
</div>
<div class="col-sm-6">
<input type="text" name="subject" placeholder="Subject">
</div>
<div class="col-sm-6">
<input type="text" name="website" placeholder="Website">
</div>
<div class="col-sm-12">
<textarea name="message" required="required" cols="30" rows="7" placeholder="Message*"></textarea>
</div>
<div class="col-sm-12">
<input type="submit" name="submit" value="Send Message" class="btn btn-send">
</div>
</div>
</form>
</div>
</div>
Can you please help me?

Fix gap from border-bottom none

I have a <a> tag with border: 1px solid #CCC; border-bottom:none; style and it's leaves a tiny gap, please look at the codepen result to see what I mean. This gap appears left from login tab if the login tab is active or right from register tab if register tab is active.
HTML:
<div id="w-login">
<div id="login">
<menu id="tabs"> <a id="tab-signin" class="tab-active"><i class="fa fa-unlock-alt"></i>Login</a><a id="tab-signup"><i class="fa fa-lock"></i>Register</a>
</menu>
<div id="signin">
<form class="form-horizontal">
<div class="form-group">
<label for="username" class="control-label col-1">Username:</label>
<input type="text" name="username" class="form-control col-2" id="si-username">
</div>
<div class="form-group">
<label for="password" class="control-label col-1">Password:</label>
<input type="password" name="password" class="form-control col-2" id="si-password">
</div>
<input type="submit" value="Login" class="btn btn-primary" id="si-submit">
</form>
</div>
<div id="signup">
<form class="form-horizontal">
<div class="form-group">
<label for="username" class="control-label col-1">Username:</label>
<input type="text" name="username" class="form-control col-2" id="su-username">
</div>
<div class="form-group">
<label for="password" class="control-label col-1">Password:</label>
<input type="password" name="password" class="form-control col-2" id="su-password">
</div>
<div class="form-group">
<label for="email" class="control-label col-1">Email:</label>
<input type="text" name="email" class="form-control col-2" id="su-email">
</div>
<input type="submit" value="Register" class="btn btn-primary" id="su-submit">
</form>
</div>
</div>
</div>
CSS:
#container {
height: 100%;
width: 100%;
text-align: center;
font-size: 14px;
}
#container:before {
content:'';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -3px;
}
#w-login {
display: inline-block;
vertical-align: middle;
width: 40%;
padding: 5px;
}
#login {
}
#signin, #signup {
border: 1px solid #CCC;
border-top: none;
padding: 20px 10px;
border-bottom-left-radius: 15px;
-webkit-border-bottom-left-radius: 15px;
-moz-border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
-webkit-border-bottom-right-radius: 15px;
-moz-border-bottom-right-radius: 15px;
}
#signup {
display: none;
}
#tabs {
padding: 0;
margin: 0;
border: 1px solid #CCC;
border-top-left-radius: 15px;
-webkit-border-top-left-radius: 15px;
-moz-border-top-left-radius: 15px;
border-top-right-radius: 15px;
-webkit-border-top-right-radius: 15px;
-moz-border-top-right-radius: 15px;
border-bottom: none;
}
#tabs a {
padding: 10px 0;
display: inline-block;
width: 50%;
cursor: pointer;
text-decoration: none;
}
#tabs .tab-active {
}
#tab-signin.tab-active {
border: 1px solid #CCC;
border-width: 0 1px 1px 0;
}
#tab-signup.tab-active {
border: 1px solid #CCC;
border-width: 0 0 1px 1px;
}
.col-1 {
width: 28%;
}
.col-2 {
width: 70%;
display: inline-block;
}
.form-horizontal .form-group {
margin-right: 0;
margin-left: 0;
}
.btn {
width: 99%;
}
.fa {
padding-right: 5px;
}
Note: the rest of the CSS styles come from Bootstrap
JS/jQuery:
$(function(){
$('#tab-signin').click(function(){
$('#signup').hide();
$('#signin').show();
switchTab();
});
$('#tab-signup').click(function(){
$('#signin').hide();
$('#signup').show();
switchTab();
});
});
function switchTab(){
$('#tabs a').toggleClass('tab-active');
}
I suggest the following approach.
I would take advantage of the fact that in your mark-up the two tab elements,
#tab-signin and #tab-signup, are children of the menu#tabs element.
That being the case, I would place the left, top and right borders on the #tabs element
and remove the left/top and top/right borders on the two children elements (#tab-signin and #tab-signup respectively).
The CSS for #tabs would look like:
#tabs{
padding: 0;
margin: 0;
border: 1px solid #CCC;
border-top-left-radius: 15px;
-webkit-border-top-left-radius: 15px;
-moz-border-top-left-radius: 15px;
border-top-right-radius: 15px;
-webkit-border-top-right-radius: 15px;
-moz-border-top-right-radius: 15px;
border-bottom: none;
}
To style the .tab-active cases, I would create two specific rules for the sign-in and the sign-up tabs, for the right/bottom and the bottom/left borders respectively:
#tabs .tab-active{
}
#tab-signin.tab-active{
border: 1px solid #CCC;
border-width: 0 1px 1px 0;
}
#tab-signup.tab-active{
border: 1px solid #CCC;
border-width: 0 0 1px 1px;
}
See demo at: http://jsfiddle.net/audetwebdesign/By4g5/
The problem you noticed earlier is not really a browser bug. The CSS specification does not specify exactly how browsers are to draw the corners of borders (the joints), so you are at the mercy of the browser for that particular design detail.
My approach is to avoid the problem by taking full advantage of the HTML mark-up in your code.
You should probably try floats but a quick fix could be negative margins...
#tabs{
padding: 0;
margin: 0px 0px -1px 0px;
}
DEMO
EDIT: inline blocks side effects, something to read ;)
http://css-tricks.com/fighting-the-space-between-inline-block-elements/
Another solution would be if set a transparent border on class .tab-active.
just using border transparent .
#tabs .tab-active{
border-bottom: 1px solid transparent;
}
Chec the DEMO.

positionning a css button

I want to make a button to appear in the next line . But i tried to use the attributes "position" and "line-height" of the button but nothing is changed .i want it in the center of the next line under the input text of tne name
this is my code :
css file :
#popup {
font-family: 'Orbitron', serif;
font-size: 28px;
font-weight: 700;
text-shadow: 0px 1px 2px #fff;
color: #222;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: rgba(0,0,0,.5);
display: -webkit-box;
-webkit-box-pack: center;
-webkit-box-align: center;
-webkit-transition: all .5s ease-in;}
#popup h1 {
font-weight: 400;
}
#popup-box {
width: 400px;
height: 300px;
background: #ccc url(../images/popup_bg.jpg);
border-radius: 10px;
position: relative;
-webkit-box-shadow: 0 5px 5px #333;
display: -webkit-box;
-webkit-box-pack: center;
-webkit-box-align: center;
-webkit-transition: all .5s ease-in;}
#popup-box small {
font-size: .6em; }
#popup.hide {
background: rgba(0,0,0,0);
visibility: hidden;
}
#popup.hide #popup-box{
margin-top: -800px;}
#popup-box a.button {
background: white;
border-radius: 10px;
display: block;
font-size: 30px;
margin: 230px auto 0;
padding: 10px;
width: 50px;
border: 3px solid #006438;
color:#006438;
text-decoration:none;
cursor:pointer;}
html file :
<section id="popup">
<div id="popup-bg">
</div>
<div id="popup-box">
<p><a id="gamelogin1" class="button" href="">choose Name</a></p>
<p><a id="gamelogin2" class="button" href="">New Name</a></p>
</div>
</section>
<section id="popupName" class="hide">
<div id="popup-bg">
</div>
<div id="popup-box">
<label for="firstName">Your Name :</label>
<input type="text" name="firstName" size="20" maxlength="40" id="firstName" />
**<p><a id="validatelogin" class="button" href="">Validate</a></p> //this is the //button i want to change**
</div>
</section>
Add a break line (<br>) after your input field:
<input type="text" name="firstName" size="20" maxlength="40" id="firstName" /><br>
Some would argue that the <br> tag should self-close: <br />, but this isn't necessary.
To make it center, use this CSS:
#validatelogin {
width:100px;
margin: 0 auto;
}
Set width to the proper width of the button; it must be fixed in order for margin: 0 auto; to work.
I'm not sure if I understand your question but maybe you can use it before your button
<div class="both"></div>
In css
.both{
clear: both;
}
You just need
input[type=text]
{
display:block;
}
and
#validatelogin{
display:block;
}
in your CSS. That Would solve your Issue

Resources