Hello,
How can I center a MailChimp button? The button is centered on desktop, but is shifted right on mobile devices, see the picture. I have been trying playing around with some classes and id's but can not solve it really. Not all the CSS code is necessary I guess. Sorry, I know it is messy. (In the HTML I have HIDDEN... the API-key)
Here is the HTML:
<!-- Begin Mailchimp Signup Form -->
<div id="mc_embed_signup">
<form id="mc-embedded-subscribe-form" class="validate" action="https://hotmail.us4.list-manage.com/subscribe/post? HIDDEN... " method="post" name="mc-embedded-subscribe-form" novalidate="" target="_blank">
<div id="mc_embed_signup_scroll">
<span class="text1">Ta del av vårt nyhetsbrev!</span>
<input id="mce-EMAIL" class="email" name="EMAIL" required="" type="email" value="" placeholder="Skriv din e-post här!" />
<!-- 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;" aria-hidden="true"><input tabindex="-1" name=" HIDDEN...
" type="text" value="" /></div>
<div class="clear">
<center><input id="mc-embedded-subscribe" class="button2" name="subscribe" type="submit"
value="Prenumerera" />
</center>
</div>
</div>
</form></div>
<!--End mc_embed_signup-->
Here are some CSS:
.button2 {
display: inline-block;
text-align: center;
font-family: lora !important;
/* vertical-align: bottom;*/
/* padding-bottom: 0px !important;*/
margin:auto !important;
height:34px !important;
line-height :34px !important;
padding: 5px 12px !important;
border: 1px solid #aeb11b;
border-radius: 8px;
background: #f8fd27!important;
background: -webkit-gradient(linear, left top, left bottom, from(#f8fd27), to(#aeb11b))!important;
background: -moz-linear-gradient(top, #f8fd27, #aeb11b)!important;
background: linear-gradient(to bottom, #f8fd27, #aeb11b)!important;
-webkit-box-shadow: #8d1bb3 0px 0px 24px 0px!important;
-moz-box-shadow: #8d1bb3 0px 0px 24px 0px!important;
box-shadow: #8d1bb3 0px 0px 24px 0px!important;
text-shadow: #ffff33 1px 1px 1px!important;
font: normal normal bold 20px arial!important;
color: #111111!important;
text-decoration: none!important;
}
.button2:hover,
.button2:focus {
border: 1px solid #f8fd27!important;[![enter image description here][1]][1]
background: #ffff2f!important;
background: -webkit-gradient(linear, left top, left bottom, from(#ffff2f), to(#d1d420))!important;
background: -moz-linear-gradient(top, #ffff2f, #d1d420)!important;
background: linear-gradient(to bottom, #ffff2f, #d1d420)!important;
color: #111111!important;
}
.button2:active {
background: #aeb11b!important;
background: -webkit-gradient(linear, left top, left bottom, from(#aeb11b), to(#aeb11b))!important;
background: -moz-linear-gradient(top, #aeb11b, #aeb11b)!important;
background: linear-gradient(to bottom, #aeb11b, #aeb11b)!important;
}
.button2:after{
content: "\0000a0"!important;
display: inline-block!important;
height: 24px!important;
width: 24px!important;
line-height: 24px!important;
margin: 0 -4px -6px 4px!important;
position: relative!important;
top: 0px!important;
left: 0px!important;
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAEJUlEQVRIiaWVXWhURxTHf3P3Zjfq5mOzZE1q1RC1Eb+yxhbBB6lN+yD40BJRUGlAUKIIRTEVn3wzfbFQqiJVH4rFL2qRih8VYkWxtCUSimWLYDS1Jm52UzfG3N17786d6UOycVc3Ee3AwHyc+f/OOcOcEYBBkTbv3Xms/mx1feX0ynWlpaXNU3xTFgSnBiNKKTlijwzanh2zM3ZnaiB19vwX53sfxR4Vk0GMAVQ+qO1EW324NtyxsHbhx0siS8xZ5bPw+/worQAwhIHlWvQ87aE73i17k70/pOKpvUc+PXI/T0cBRj4AwNh+bvumurfqDi2rXRYESGQSDNlDZFUWpRUCgSEMAmaAUGmIyNQIz5xndPV3DSeSiW2HWw6fznNYFUSw5dyWz8tCZR3VU6uLhjtZ87RHMp3EGrLaj7Uc+zLndA7AhpMbNgWrgt9WlFYQLAm+NgBgMDOIIx1GnoxsPLnh5OlxwJpDa+orZ1Z2C58IVgYqKfOXvREgmUliSxvt6eHUw1TjxR0Xe81INIJZZXY42gkiYVAN4vf5EYjxgzPKZrBq5iqEGF27PXCb2GCsQNxVLkP2UG5abobNjoq5FRt9S9uXzimpKjkotTSkkriei5W18Pv8aDSe9njqPCVUGmLl2yupmVbDovAi+qw++q1+PO1hZS36RvpwPRepJFJJlKHml88p/843e/3sNl2iP8ptSCWxpU3KTuF4DhoNAu4P3cf1XOZXzcdn+FhcvZh7qXt0J7oZSA8UiEslkVoaylD9pivcZk96RXNqZS3iVhyAEqOEu6m7xK04bdE2TGGyLbqNx9Zjbj66WfS8Z3jNovGbxsdGwKjJ31gxYwWhQGjCy2x5p4VoJAqA4znsvbGX6/9cf8lOOapfNBxt8IQhCsrFqTWnaKxuRAiB1hpg0rHruez8eSfXHl4rAGipXdOW9kvVKFcSciKvGiutSGfTZGTmRQBm2k4nhF8UpOhA1wHCU8JF0yMQtC5spWl6EwAZmWHrT1u5+vfVl2y1qxOmLe0YBgWACz0XiooD7Fq2i2gkitYax3NovdzKlQdXihtLYmbGznRi8MGEinmet7/Xzr4V+4DRy113YR2XH1ye+FCGTsFO5jKdvxCYkwH2LN/D/pX7MYRBJpth/Y/rJ40UjSROg6Aeg02cIcDaiWybaprYvXz3ePk48ecJLvVcmswfcDjNcTaOVtMd1BHmDwRvVkZfbIph/qWRQ/T6AMHvPKGJPkw+QcH/7s/YzNfcAsQoADS/coel2Bh8iH5DYQ9I085XHM3F8hwAmt/4hSXcG4MEXktcMozFZg5ydGxFA+QDRt9zF3eYyxkMatE0oDBe4bXE4Swp1nKcW2Oei1x/8dNnfF6LwfvUM421+GgGFmAQQaPQJIAYHp2M8D2d9JJ8/tHn6/wHNkwY75YHNyEAAAAASUVORK5CYII=") no-repeat left center transparent!important;
background-size: 100% 100%!important;
}
#mc-embedded-subscribe {
font-family:lato !important;
text-transform: none !important;
}
.validate {
text-transform: none !important;
font-family: helvetica;
font-weight:700 !important;
width: 100% !important;
text-align: center !important;
font-size: 19px !important;
line-height: 30px;
font-style: normal;
}
#mc-embedded-subscribe-form,
#mc_embed_signup {
padding: 0px 0px !important;
margin: 0px 0px !important;
}
.mc_embed_signup_scroll,
.mc-embedded-subscribe
.validate
.clear {
position: absolute;
padding: 0px 0px !important;
margin: 0px 0px !important;
left: 50%;
font-family: arial !important;
top: 10%;}
#mc_embed_signup input.email {
height:35px !important;
width: 220px;
}
Your code snippet provided is working just fine.
Problem is that in your page, that you provided in comment, there is float: right declared on your button which I saw by inspecting that element:
input[type=submit], button, input[type=button] {
border: none;
text-transform: uppercase;
margin: 10px 0px 0px;
padding: 11px 20px;
float: right;
...
}
Removing it fixed the issue.
One more thing. Try not to use <center> tag as it is not supported by HTML5
Since you are using WordPress theme that is maybe not editable, add internal or inline style float: none to your HTML page:
Internal style:
<head>
<style>
input[type=submit], button, input[type=button] {
float: none;
}
</style>
</head>
Inline style
<input id="mc-embedded-subscribe" class="button2" name="subscribe" type="submit"
value="Prenumerera" style="float: none"/>
To inspect an element:
Go to your website page
Right click on button
Left click on "Inspect element"
You will see HTML of your page and next to that CSS. Scroll down to see the code that I provided in my answer.
Related
I am trying to get an image inside of the following search box:
<input class="search" type="text" name="q" id="q" size="70" maxlength="2048" style= "display:block; position:relative; left:35.5%; bottom:-3px; height:2em;">
</input>
When I try to direct the mic image to go inside of the search box, it ends up disappearing behind the box. Does anyone know how to place this image inside of the search box without it vanishing?
Here is the fiddle for it: https://jsfiddle.net/gLvzdj0n/3/
Check out this Jsfiddle link
HTML code:
<div class="wrap left rounded">
<input type="text" class="search left rounded" value="Search for dishes or restaurants" />
<button class="go left rounded"><span></span></button>
</div>
CSS code:
.left {
float:left;
}
.rounded {
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
}
.wrap {
position:relative;
padding:5px 6px 6px 7px; /* readjust in jsfiddle*/
background:#f0f0f0;
border:1px solid #ccc;
overflow:hidden;
}
.search {
width:360px;
position:relative; top:2px; /* readujst in jsfiddle */
padding:8px 5px 8px 30px;
border:1px solid #ccc;
background:white url(http://i.imgur.com/lFkqn.png) left center no-repeat;
}
.go {
position:relative; top:0;
padding:3px 5px 2px;
margin-left:8px;
border:none;
background: -webkit-gradient(linear, left top, left bottom, from(#d631a7), to(#8f1b64));
background: -moz-linear-gradient(top, #d631a7, #8f1b64);
}
.go span {
display:block;
width:64px; height:28px;
background:url(http://i.imgur.com/mxxzQ.png) 0 0 no-repeat;
}
You can solve this problem by css (position)
as the following:
<div id="MyDiv" style="position: absolute;">
<img src="img/clearSearchbutton.png" id="imgInInput" style="position: absolute;">
</div>
then give your div style like margin or padding to put your image inside input
Note if you need 'X' button just do this
<input class="search" type="search" name="q" id="q" size="70" maxlength="2048" style= "display:block; position:relative; left:35.5%; bottom:-3px; height:2em;">
</input>
you can remove #mic span and apply mic to input background.
see jsfiddle below
Demo Jsfiddle
change your css like below
.search {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACrElEQVR42u2Xz2sTQRSAX8VSb1K8iNqKooJH2Ux6Ksn+iPQqxZMIehJB0do/IMhmQWsvHr2KSEGk0tSLIoWIYNUKij20F2/N7iaUZnYT0kYzzhMKs0HDJiTdLcwHDwKZSd63781LBiQSSW9JZdkhzfKm1Rz9mjZp/W9YdEU3vXv4HsQZ40FtNG36q5rls//Ej4tmbSS2T15Mvp3ExOPmEMQNbBtMMEyoljcFcQN7PqyAlqNfIG7gYQ0tYNIaxA1MrJPY3wImbUqBKAXSFv0tBSIVMOkvKRDtGKWN/T6FdqRAxFNoWwpEPIXqUqBT6ALU/UVgu8GW4GD3f6f9TRDYNJTDrk7YbtiqUumHwIYoUJuHERDAS0r4CvgFECgbY+cFAR7KT+g1POmCKFDNw6WggHc3fBtVb4CAoyauBgXIG+g1Xh5mRAGah6cggBd11fK/h7lOprIs0H6uRl6KAo5O7kOv4QmPiwJ4Jqqv4FiwCtXjvD2+tRmfK6kZ/ygI2HritK0rDVGgrClJ6DWMwYC/AGuCBMYcIC2V0CzvjmbRz3j3xUjn6CfeYreUJ2wQkGD75INPX1mFfsEFrrcIYCvdhC4paWQakxajpJMr0C9YFg54i7AsClRmh9/xnr0NHcInzZStk2aLwAcGMAD9pPIazvFKVDD5rdnhJeHLX5RTyRPQHpz5o66emMc9wdlPtvA8wF7Aq2BUHh1525qEo5JtR1WeOXpickO9cJIpyuD6xJmhYiZ5ytWSl3mlnuOaf+2zDaLDXmJrSgZ/MYVEugo+gSh+FkSBa4yd5Ul87DZ5XpFl/AyIEjzYjkau8WqshU2cr13HPbgX4gJOD97n465GZlyVvC9mSKloKI2iTnbwNT+gBX54H+IaXAtxJzE3ycSAFqSAFJACUkAikXD+AHj5/wx2o5osAAAAAElFTkSuQmCC");
background-position: right center;
background-repeat: no-repeat;
background-size: 24px 24px;
}
Check this out.
I had edited your fiddle.
#mic {
background-position: -2.99999976158142px 0px;
color: rgb(17, 34, 204);
cursor: pointer;
display: block;
height: 22.9861125946045px;
vertical-align: middle;
white-space: nowrap;
width: 16.9965286254883px;
perspective-origin: 8.48958396911621px 11.4930562973022px;
transform-origin: 8.48958396911621px 11.4930562973022px;
background: rgba(0, 0, 0, 0) url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACrElEQVR42u2Xz2sTQRSAX8VSb1K8iNqKooJH2Ux6Ksn+iPQqxZMIehJB0do/IMhmQWsvHr2KSEGk0tSLIoWIYNUKij20F2/N7iaUZnYT0kYzzhMKs0HDJiTdLcwHDwKZSd63781LBiQSSW9JZdkhzfKm1Rz9mjZp/W9YdEU3vXv4HsQZ40FtNG36q5rls//Ej4tmbSS2T15Mvp3ExOPmEMQNbBtMMEyoljcFcQN7PqyAlqNfIG7gYQ0tYNIaxA1MrJPY3wImbUqBKAXSFv0tBSIVMOkvKRDtGKWN/T6FdqRAxFNoWwpEPIXqUqBT6ALU/UVgu8GW4GD3f6f9TRDYNJTDrk7YbtiqUumHwIYoUJuHERDAS0r4CvgFECgbY+cFAR7KT+g1POmCKFDNw6WggHc3fBtVb4CAoyauBgXIG+g1Xh5mRAGah6cggBd11fK/h7lOprIs0H6uRl6KAo5O7kOv4QmPiwJ4Jqqv4FiwCtXjvD2+tRmfK6kZ/ygI2HritK0rDVGgrClJ6DWMwYC/AGuCBMYcIC2V0CzvjmbRz3j3xUjn6CfeYreUJ2wQkGD75INPX1mFfsEFrrcIYCvdhC4paWQakxajpJMr0C9YFg54i7AsClRmh9/xnr0NHcInzZStk2aLwAcGMAD9pPIazvFKVDD5rdnhJeHLX5RTyRPQHpz5o66emMc9wdlPtvA8wF7Aq2BUHh1525qEo5JtR1WeOXpickO9cJIpyuD6xJmhYiZ5ytWSl3mlnuOaf+2zDaLDXmJrSgZ/MYVEugo+gSh+FkSBa4yd5Ul87DZ5XpFl/AyIEjzYjkau8WqshU2cr13HPbgX4gJOD97n465GZlyVvC9mSKloKI2iTnbwNT+gBX54H+IaXAtxJzE3ycSAFqSAFJACUkAikXD+AHj5/wx2o5osAAAAAElFTkSuQmCC) no-repeat scroll -2.99999976158142px 0px / 23.9999980926514px 23.9999980926514px padding-box border-box;
border: 0px none rgb(17, 34, 204);
font: normal normal normal normal 16px/38px arial, sans-serif;
outline: rgb(17, 34, 204) none 0px;
right: 10px;
top: 15px;
position: absolute;
}
/*#SPAN_1*/
<input class="search" type="text" name="q" id="q" size="70" maxlength="2048" style="display:block; position:relative; left:35.5%; bottom:-3px; height:2em;">
</input>
<span id="mic"></span>
Try this link and I think that is what you want
http://codepen.io/rafibomb/pen/rFgcI?editors=101
placing an image inside search box.
Keep it SIMPLE!
All you need to do is just put your stuff in a container div like this:
<div style="width:50px; height:20px; position:absolute;">
<input class="search" type="text" name="q" id="q" size="70" maxlength="2048" style= "display:block; position:relative; left:35.5%; bottom:-3px; height:2em; z-index:1;">
</input>
<span id="mic"></span>
</div>
Remove left and bottom (they are not much needed) from your input box and ADD position:absolute;.
This is the CSS for your <input>:
display: block;
height: 2em;
width: 100%;
position: absolute;
And now Remove margin-left:800px; and ADD position: absolute; , right: 0px; and margin-top: 4px;. Here is the CSS for your <span>
color: #12C;
cursor: pointer;
display: block;
vertical-align: middle;
white-space: nowrap;
width: 16.9965px;
border: 0px none #12C;
outline: 0px none #12C;
height: 22.9861px;
background: transparent url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACrElEQVR42u2Xz2sTQRSAX8VSb1K8iNqKooJH2Ux6Ksn+iPQqxZMIehJB0do/IMhmQWsvHr2KSEGk0tSLIoWIYNUKij20F2/N7iaUZnYT0kYzzhMKs0HDJiTdLcwHDwKZSd63781LBiQSSW9JZdkhzfKm1Rz9mjZp/W9YdEU3vXv4HsQZ40FtNG36q5rls//Ej4tmbSS2T15Mvp3ExOPmEMQNbBtMMEyoljcFcQN7PqyAlqNfIG7gYQ0tYNIaxA1MrJPY3wImbUqBKAXSFv0tBSIVMOkvKRDtGKWN/T6FdqRAxFNoWwpEPIXqUqBT6ALU/UVgu8GW4GD3f6f9TRDYNJTDrk7YbtiqUumHwIYoUJuHERDAS0r4CvgFECgbY+cFAR7KT+g1POmCKFDNw6WggHc3fBtVb4CAoyauBgXIG+g1Xh5mRAGah6cggBd11fK/h7lOprIs0H6uRl6KAo5O7kOv4QmPiwJ4Jqqv4FiwCtXjvD2+tRmfK6kZ/ygI2HritK0rDVGgrClJ6DWMwYC/AGuCBMYcIC2V0CzvjmbRz3j3xUjn6CfeYreUJ2wQkGD75INPX1mFfsEFrrcIYCvdhC4paWQakxajpJMr0C9YFg54i7AsClRmh9/xnr0NHcInzZStk2aLwAcGMAD9pPIazvFKVDD5rdnhJeHLX5RTyRPQHpz5o66emMc9wdlPtvA8wF7Aq2BUHh1525qEo5JtR1WeOXpickO9cJIpyuD6xJmhYiZ5ytWSl3mlnuOaf+2zDaLDXmJrSgZ/MYVEugo+gSh+FkSBa4yd5Ul87DZ5XpFl/AyIEjzYjkau8WqshU2cr13HPbgX4gJOD97n465GZlyVvC9mSKloKI2iTnbwNT+gBX54H+IaXAtxJzE3ycSAFqSAFJACUkAikXD+AHj5/wx2o5osAAAAAElFTkSuQmCC") no-repeat scroll -3px 0px / 24px 24px;
position: absolute;
right: 0px;
perspective-origin: 8.48958px 11.4931px;
transform-origin: 8.48958px 11.4931px 0px;
margin-top: 4px;
Hope this resolves your issue.
P.S.Whatever CSS i have mentioned in this is an update of your present link of JSFiddle.
I have a login form that is perfectly correct in all other browsers. However, sometimes it gets twisted in Google Chrome. Sometimes it shows up correctly - but almost always it incorrect.
CSS
* {
margin: 0;
padding: 0;
width: auto;
}
body {
background: #E8E8E8;
}
#logo {
width: 244px;
height: 70px;
margin: 0 auto;
border: 0;
background: url(../img/logo.png) no-repeat;
}
#loginbox {
width: 330px;
height: auto;
border: 1px solid #6A6A6A;
background: url(../img/bg-top-login.png) repeat-x;
margin: 0 auto;
padding: 5px;
border-radius: 5px 5px 0 0;
margin-top: 80px;
box-shadow: 0 0 10px #828282;
-webkit-box-shadow: 0 0 10px #828282;
-moz-box-shadow: 0 0 10px #828282;
}
You should use these images as css background:
<p class="textlogin">Usuario</p>
<input type="text" placeholder="Digite Seu Nome de úsuario" name="usuario" />
<div class="ico"><i class="usuario"></i></div>
<p class="textlogin">senha</p>
<input type="password" placeholder="Digite a senha da conta" name="senha" />
<div class="ico"><i class="senha"></i></div>
CSS:
.ico i {
display: block;
width:20px;
height:20px;
margin-top:2px;
margin-left:4px;
}
.ico i.usuario {
background-image: url('http://s12.postimg.org/ad8v4wvex/user.png');
}
.ico i.senha {
background-image: url('http://s13.postimg.org/iexiozs83/loked.png');
}
Your CSS has an incorrect property .ico class too, that could be the cause of breaking layout:
.ico{
top:-12px;);
You should also consider using a background-color as fallback in case background gradient image is not loaded:
.ico{
background:#eee url(../img/bg-ico.png) repeat-x;
}
See updated fiddle: http://jsfiddle.net/n23fh/3/
I am trying to have it so users can log in into my website using fb etc. For some reason, the text gets hidden behind the buttons in my existing code. I am not sure what's wrong since the text used to show up where it needed to be up until I changed the background of the buttons and added social icons to them. Could you please help?
Here is the relevant code:
HTML:
<a class="alt-sign-in facebook">Login with facebook</a>
<a class="alt-sign-in google">Login with google</a>
<a class="alt-sign-in twitter">Login with twitter</a>
<form>
<input type="text" name="name" placeholder="name">
<input type="text" name="email" placeholder="email">
<input type="submit" name="submit">
</form>
<button id="computer-button">Start</button>
</div>
CSS:
#import url('http://weloveiconfonts.com/api/?family=entypo');
#import url('http://weloveiconfonts.com/api/?family=zocial');
html, body {
height: 100%;
background: #ddd;
}
.alt-sign-in {
position: relative;
display:block;
height: 40px;
width: 300px;
margin: 10px 0px auto auto;
padding: 5px;
font: 700 16px/40px'Quattrocento Sans', sans-serif;
text-decoration: none;
text-transform: uppercase;
text-align:center;
line-height: 40px;
color: #555;
border-radius: 2px;
background: linear-gradient(to bottom, white 40%, lightgrey);
box-shadow: 0 1px 1px rgba(0, 0, 0, .5);
cursor: pointer;
box-sizing: border-box;
}
.alt-sign-in:before {
color:white;
position:relative;
top: -5px;
left: -5px;
display:block;
box-sizing: border-box;
height: 40px;
width: 45px;
font: 20px/40px entypo;
text-align: center;
color: #fff;
border-radius: 2px 0 0 2px;
}
http://jsfiddle.net/prettysweet/Dv9rC/24/
Thank you so much!
The code you have posted seems to be an incomplete, or older version.
But by judging from your jsfiddle link, I suggest to change the following;
.alt-sign-in {
/* removed: box-sizing: border-box; */
}
.alt-sign-in:before {
position:absolute;
top: 5px;
left: 5px;
}
see http://jsfiddle.net/Dv9rC/27/
I think you have floating element problem. If you add these lines to your css code, it'll be OK.
.alt-sign-in.facebook:before {
...
float: left;
}
.alt-sign-in.google:before {
...
float: left;
}
.alt-sign-in.twitter:before {
...
float: left;
}
Bonus Edit: After adding all of these codes, just add form tag to your CSS document for top margin.
form{
margin-top:15px;
}
I'm trying to make a text field and a button appear like they are part of a joint element, so that they look like this (screenshot from Chrome Linux):
However in Firefox Linux the button is two pixels too tall:
Example CSS: http://dabblet.com/gist/1603701
I have set the font size of both elements to 16px in the hope that they will display the same, giving a line-height of 19px - but in Firefox the button has a height of 21px instead! Setting an explicit height can lead the vertical alignment to become incorrect in Firefox unless I shrink the font (not sure why that is).
Apparently you can't set the line-height on inputs in Firefox (see article and bug report), so how else can I force the elements to be the right height?
Any suggestions?
Here's a cross-browser solution:
<!doctype html>
<html lang="en">
<head>
<style>
html, body{
padding: 50px;
}
.inputWrapper{
display:inline-block;
font-size:16px;
padding:0px;
border:1px solid #000000;
border-radius:6px;
background-color:#ffffff;
}
.email{
margin:0px;
margin-left:1px;
padding:5px;
border-width:0px;
border-radius: 6px 0px 0px 6px;
}
.submit{
margin: -1px;
margin-left: -5px;
padding: 6px;
border-width:0px;
border-radius: 0px 6px 6px 0px;
color:#ffffff;
background-color:#D94E35;
}
</style>
</head>
<body>
<div class="inputWrapper">
<input class="email" type="email" value="" placeholder="email address"/>
<input class="submit" type="submit" value="Subscribe" />
</div>
</body>
</html>
You can see it working here: http://dabblet.com/gist/1604595
you have two different paddings on your form boxes, very easy fix.
Change your CSS from this >
input[type="submit"] {
margin: 0;
padding: 6px 15px; /* Padding set 1px to high, so your getting 2px total extra space */
border: none;
border-radius: 0 6px 6px 0;
font-size: 16px;
line-height: normal;
color: white;
background: #D94E35;
}
To This >
input[type="submit"] {
margin: 0;
padding: 5px 15px; /* Now you should have even paddings */
border: none;
border-radius: 0 6px 6px 0;
font-size: 16px;
line-height: normal;
color: white;
background: #D94E35;
}
Hi all and good morning!
The issue I'm having today is with IE7's rendering (shock, horror) of my work in progress website. Below is some code that is intended to create a page wide <div> that has an image on the left hand side (an arrow) and then 2 lines of text to the right of the image, then a progress bar holder <div> with another <div> inside that will be widened and narrowed to fill the progress bar.
<div class="courseItem">
<img src="images/courses-arrow.jpg" width="41" height="41" alt="->" />
<p><span class="title">Intermediate Microsoft Excel 2010</span><br />
<strong>Last accessed:</strong> 21st September 2011</p>
<div class="courseProgress">
<div class="progressContainer">
<div class="progressFill" style="width: 60px">
</div>
</div>
<p>50%</p>
</div>
<div class="clearBoth"></div>
</div>
Now, what's the problem you ask? Well the issue is that for some reason, and this has really stumped me, the first of these bar divs (there are 4 in total, all exactly the same as the code above, no changes what so ever) has a massive white space between itself and its border which forces the other 3 bars below to be pushed away.
Here's the css;
.courseItem {
margin: 0px 0px 15px 0px;
border-bottom: 1px solid #b0dff7;}
.courseItem img {
float: left;
margin: 0px 20px 15px 0px;}
.courseItem p {
font-size: 11px;
color: #999999;
margin: 5px 0px 0px 0px;
padding: 0;
float: left;}
.courseItem p span.title {
margin: 0;
padding: 0;
font-weight: bold;
font-size: 12px;
color: #00154d}
.courseItem .courseProgress {
float: right;}
.courseItem .courseProgress p {
width: 50px;
font-size: 20px;
color: #52b9ed;
margin: 7px 0px 0px 10px;}
.courseItem .courseProgress .progressContainer {
margin: 15px 0px 0px 0px;
padding: 0;
width: 120px;
height: 12px;
background: url(../images/courses-empytprogress.jpg) no-repeat;
float: left;}
.courseItem .courseProgress .progressContainer .progressFill {
margin: 1px 0px 0px 0px;
height: 10px;
max-width: 120px;
background: url(../images/courses-fillprogress.jpg) repeat-x;
float: left;}
This is the visual representation
http://img1.uploadscreenshot.com/images/orig/10/29204251178-orig.jpg
Thanks in advance.
(Sorry for long windedness, just trying to paint a picture)
Remove the float:left property of .div p, and add display:inline-block;. Then, define the clear:both CSS property for the .clearBoth class.
Fiddle: http://jsfiddle.net/Jqhe8/
Fixed CSS:
.courseItem p {
font-size: 11px;
color: #999999;
margin: 5px 0px 0px 0px;
padding: 0;
display: inline-block; /*Removed float, added display*/
}
.clearBoth { /*Define clear:both!!!*/
clear: both;
}
In your code you didn't clear it's parent div & you .clear class is not working so; first clear the parent div because the child div's have float in it. Write like this
.courseItem {
border-bottom: 1px solid #B0DFF7;
margin: 0 0 15px;
overflow: hidden;
}