CSS elements won't line up - css

I have just embedded a newsletter field and button into my website, the field sits nicely but the button is too low. I tried different styles but nothing seems to work.
http://www.pazzle.co.uk/
Just underneath the banner.
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="http://pazzle.us6.list-manage.com/subscribe/post?u=7167bf73b26b7bd1298d4f925&id=a48b73e435" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
<div class="clear">
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
</form>
</div>
<!--End mc_embed_signup-->
#mce-EMAIL {float:left;}
#mc-embedded-subscribe {}
/* MailChimp Form Embed Code - Slim - 08/17/2011 */
#mc_embed_signup form {display:block; }
#mc_embed_signup h2 {font-weight:bold; padding:0; margin:15px 0; font-size:1.4em;}
#mc_embed_signup input {border:1px solid #999; -webkit-appearance:none;}
#mc_embed_signup input[type=checkbox]{-webkit-appearance:checkbox;}
#mc_embed_signup input[type=radio]{-webkit-appearance:radio;}
#mc_embed_signup input:focus {border-color:#333;}
#mc_embed_signup .button {clear:both; background-color: #aaa; border-radius:4px; color: #FFFFFF; cursor: pointer; font-size:15px; font-weight: bold; line-height: 28px; padding:0; text-align: center; text-decoration: none; vertical-align: top; white-space: nowrap; width: auto;}
#mc_embed_signup .button:hover {background-color:#777;}
#mc_embed_signup .small-meta {font-size: 11px;}
#mc_embed_signup .nowrap {white-space:nowrap;}
#mc_embed_signup .clear {clear:none; display:inline; float:left;}
#mc_embed_signup input.email {display:block; padding: 5px 0; text-indent: 8px; width: 120px !important; margin-left: 13px;margin-top: 5px; float:left;}
#mc_embed_signup input.button {display:block; min-width: 50px; height: 28px; margin-top: 5px;}
#mc_embed_signup div#mce-responses {float:left; top:-1.4em; padding:0em .5em 0em .5em; overflow:hidden; width:90%;margin: 0 5%; clear: both;}
#mc_embed_signup div.response {margin:1em 0; padding:1em .5em .5em 0; font-weight:bold; float:left; top:-1.5em; z-index:1; width:80%;}
#mc_embed_signup #mce-error-response {display:none;}
#mc_embed_signup #mce-success-response {color:#529214; display:none;}
#mc_embed_signup label.error {display:block; float:none; width:auto; margin-left:1.05em; text-align:left; padding:.5em 0;}
#mc_embed_signup {float:left; height: 30px;}

Try adding float: left to the #mc_embed_signup .clear div and the #mc_embed_signup input.email textbox

The issue is here in the CSS:
#mc_embed_signup .button on line 1176 of stylesheets.css
Get rid of the clear:both from that class and it will get the submit button in line with the form field. From there you should be able to fix up the margin/positioning.
clear:both essentially prevents the element from ever being inline with any other element. It clears floats such that it can't be floated next to another element.

not sure if this is exactly what you were talking about but I added #mc_embed_signup .clear { float: right;}. this will put the submit button into the form box and then you can get specific with alignment using postion:relative

Related

How to set label and input in one line?

Hi i have a diferent style because betwin labale and input set icon. Please lock at the https://jsfiddle.net/mL1o0d5m/
css codes :
body{
font-family: tahoma;
font-size:14px;
background-color:#f1f1f1;
color:#999;
direction:rtl;
}
.form{
font-size:14px;
width:100%;
}
.form label{
text-align: right;
clear: both;
float:right;
}
.form input.inputs{
font-size:14px;
color:#999;
display:block;
border:1px solid #ccc;
border-right:none;
background-color:#fff;
width:80%;
margin-bottom:20px;
padding:10px;
padding-right:30px;
box-sizing:border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-shadow:none;
-webkit-appearance: none;
}
.addon{
position:relative;
font-size:0;
}
.addon:before{
display:block;
content:"";
width:3px;
height:100%;
background-color:#3399cc;
position:absolute;
}
.icon:before{
font-size:14px;
color:#bbb;
position:absolute;
top:12px;
right:12px;
}
HTML :
<form class="form">
<label>Name</label>
<div class="addon">
<i class="icon fa fa-user"></i>
<input class="inputs" name="name" type="text" placeholder="Name" />
</div>
</form>
I wanna to set label and input in same line .label should be in right and input and icon must be at left .
Thanks .
like this? https://jsfiddle.net/mL1o0d5m/1/ it is one of the many posibilities to achieve this. Added some css
.form > label{
text-align: right;
float:right;
width:40px;
margin-top:10px;
}and also to .icon:before and .addon:beforeSee in fiddle

add little dropdown menu to existing button in pure CSS

I have that simple button in my application. I want to add little dropdown when hover on it and also to see icons then name on the option list coming up and all thin in pure css so I can link to php pages when clicking on the menu.
http://jsfiddle.net/seby20/JB59c/
CSS
.ann_search_submit {
background:transparent url("images/fancybutton.png") no-repeat top left;
max-width : 131px;
}
.newhead{
padding-left:4px;
padding-right:4px;
margin-right:2px;
padding-top:4px;
padding-bottom:1px;
cursor:pointer;
line-height:16px;
margin-top:2px;
text-decoration: none;
font-size: 12px;
}
.ann_submit {
color : #09509B;
padding: 4px;
margin:0px 0px 5px 3px;
border : none;
background:transparent url("images/fancybutton.png") no-repeat top right;
}
.ann_submit:hover {
color:#0271E6;
}
HTML
<div class="newhead" >
<div class="ann_search_submit">
<div class="ann_submit"><img src="images/plus-icon 2.png" title="Add Call" align="absmiddle" >
<?=HEAD_BUTTON_ADD_CALL?>
</div>
</div>
</div>
Use this code
HTML
<div class="ann_search_submit">
<div class="ann_submit">
<img src="http://www.mkstats.ca/plus-icon 2.png" title="Add Call" align="absmiddle" >
Add New Phone Call</div>
<div class="dropdown">
Option1 <br/>
Option2 <br/>
Option3 <br>
</div>
</div>
CSS
.ann_search_submit {
background:transparent url("images/fancybutton.png") no-repeat top left;
max-width : 131px;
}
.newhead {
padding-left:4px;
padding-right:4px;
margin-right:2px;
padding-top:4px;
padding-bottom:1px;
cursor:pointer;
line-height:16px;
margin-top:2px;
text-decoration: none;
font-size: 12px;
}
.ann_submit {
color : #09509B;
padding: 4px;
margin:0px 0px 5px 3px;
border : none;
background:transparent url("http://www.mkstats.ca/fancybutton.png") no-repeat top right;
}
.ann_submit:hover {
color:#0271E6;
}
.dropdown {
display: none;
height:100px;
width:200px;
}
.ann_search_submit:hover>.dropdown {
display: block;
}

css dialox box to html li item

how can I have kinda like dialog boxes besite the bullet of a li element?
<div class="contentContenedor">
<div class="tituloContentContenedor">Box: Promociones nacionales</div>
<div class="linksContentContenedor">
<ul>
<li>
<span>Vuela barato por Chile</span>
<span class="linksContentContenedorClicks" style="background-color:blue; color:white; float:right; padding:0px 4px 0px 4px">612</span>
</li>
<li>
<span>Encántate con el sur de nuestro país</span>
<span class="linksContentContenedorClicks" style="background-color:blue; color:white; float:right; padding:0px 4px 0px 4px">102</span>
</li>
<li>
<span>Disfruta el norte de Chile</span>
<span class="linksContentContenedorClicks" style="background-color:blue; color:white; float:right; padding:0px 4px 0px 4px">64</span>
</li>
<li>
<span>Canjea tus kms. y vuela por Chile</span>
<span class="linksContentContenedorClicks" style="background-color:blue; color:white; float:right; padding:0px 4px 0px 4px">49</span>
</li>
</ul>
</div>
</div>
(I can change de order of the span, or put the info outside the li)
CSS:
.contentContenedor{
background-image:url('img/fondo_cajas_home.gif');
background-repeat:no-repeat;
background-position:center bottom;
width:270px;
height:140px;
}
.tituloContentContenedor{
background-image:url('img/fondo_tit_cajas_home_270_23.gif');
background-repeat:no-repeat;
width:270px;
height:23px;
color:white;
font:bold 11px Arial,Helvetica,sans-serif;
padding:6px 0px 2px 11px;
}
.linksContentContenedor{
font-size:12px;
text-decoration:underline;
color:#0267C3;
}
.linksContentContenedor ul{
padding:0;
margin:0;
margin-left:28px;
padding-bottom:10px;
}
.linksContentContenedor li span{
position:relative;
left:-5px;
}
.linksContentContenedorClicks{
position:absolute;
left:10px;
}
I'm able tu add a square with info beside de li element but it stays inside de container.
I'd like it to be like:
but for each li element and always pointing to the bullet.
what complicates me the most is that im not able to get the info outside the container.
if I add absolute position then I wouldnt know the left and top margins since, this boxes are php created.
PS: it is not a tooltip, kinda looks like it but it has to be always present, not when hovering or whatever.
thsnk youuu!
Here is what I did,
.info {
position: absolute;
right: 115%;
width: 60px;
height: 40px;
background: #c1c1c1;
text-align: center;
}
.info:before {
content: "";
height: 0;
width: 0;
position: absolute;
left: 100%;
border-left: 15px solid #c1c1c1;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
This css will make the "info box" you are looking for. This is just a start so you can tweek it in anyway you want. If you are looking for just a border and not solid color then I would advice you to use an image. It could be possible I believe but not very effect/supported.
Here is the JSFIDDLE with the rest of css. Just make sure the li containing the .info is position: realtive;.

why div in center

I know its the noobest question you had every seen but but really guys I am not able to find whats wrong in my css. I am trying to float two divs inside a footer div. But the problem is that the first div (#copyrights) is just stuck in the middle. It looks like there's something wrong with the main container (#footer). Because when I place the last container outside it then everything works great
Have a look at my code on jsfiddle.
Heres my HTML (The footer div is at the bottom):
<div id="footer">
<!-- Upper footer -->
<div id="upper-footer">
<!--Footer Navigation Links -->
<ul>
<li>
Home
</li>
<li>
About Us
</li>
<li>
The Mall
</li>
<li>
Media Center
</li>
<li>
Contact Us
</li>
</ul>
<!-- End od Footer nav links -->
<!--Start of newsletter div -->
<div id="newsletter">
<span>SignUp To Get The Latest News & Updates</span>
<form>
<input class="rounded" type="text" value="Your Email Here..." >
<input class="rounded-button" value="SUBSCRIBE" type="button" >
</form>
</div>
<!--End of Newsletter div-->
</div>
<!-- End of upper footer -->
<!-- Start of lower footer -->
<div id="lower-footer">
<div id="copyrights">
2013 Boulevar Mall. All rights reserved.
</div>
<div id="social">Follow us </div>
</div>
<!--End of lower footer -->
And here's my css:
#import url(http://fonts.googleapis.com/css?family=Droid+Sans);
#footer
{
height:100px;
font-family: 'Droid Sans', sans-serif;
text-transform:capitalize;
font-size:14px;
}
/*css for upper footer */
#upper-footer
{
height:70%;
background-color:#efe7e1;
}
#upper-footer #newsletter
{
float:right;
height: 100%;
display: table;
}
#upper-footer ul
{
list-style:none;
margin-top: 0px;
float:left;
width:480px;
}
#upper-footer ul li
{
display:inline-block;
height: 100%;
border-left: 1px solid d7cfca;
}
#upper-footer ul li:nth-child(1)
{
border-left:none;
}
#upper-footer ul li a
{
line-height:200%;
text-decoration:none;
color:#9b907c;
display:block;
line-height:70px;
padding-left:15px;
padding-right:15px;
width: 100%;
}
#upper-footer #newsletter span
{
color:#726753;
width:150px;
display: table-cell;
vertical-align: middle;
}
#upper-footer #newsletter form
{
display: table-cell;
vertical-align: middle;
padding-left: 15px;
}
/*for rounded text box */
input.rounded
{
border: 1px solid #ccc;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: 2px 2px 3px #666;
-webkit-box-shadow: 2px 2px 3px #666;
box-shadow: 2px 2px 3px #666;
font-size: 9.42px;
padding: 4px 7px;
outline: 0;
-webkit-appearance: none;
height:26px;
width:163px;
text-align:center;
}
/*for rounded button */
input.rounded-button
{
border: 1px solid #ccc;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
font-size: 9.42px;
padding: 4px 7px;
outline: 0;
-webkit-appearance: none;
height:29px;
width:80px;
background-color:#726753;
color: white;
font-weight: bold;
}
input.rounded-button:hover
{
background-color:white;
border:#726753 solid 1px;
color:#726753
}
/*css for lower footer */
#lower-footer
{
background-color:#726753;
height:30%;
color:white;
}
#lower-footer #copyrights
{
float:left;
}
#lower-footer #social
{
float:right;
}
Your're free to point out my mistakes as I am very new to this stuff :)
Thanks in advance!
It is the margin on #upper-footer ul that's not letting your #copyrights float to the extreme left. Try replacing #upper-footer ul rule with following
#upper-footer ul
{
list-style:none;
margin: 0;
float:left;
width:480px;
}
it sets all margins for #upper-footer ul to zero instead of only margin-top.
Update
As the margin of the #upper-footer ul element is overflowing out of its parent, #upper-footer, setting overflow: hidden for #upper-footer will also do the trick.

float elements of contact form to different sides

I have a contact form that I would like all elements to be floated to the left and aligned vertically, with the exception of the "message" box and submit button which should be floated and aligned on the right.
Currently, all fields seem to be flowing horizontally. How can I remedy?
jsfiddle
<div id="contact">
<div id="contact-form" class="clearfix">
<h2><img src="img/chat.png" alt="contact frsh studio"></h2>
<ul id="errors" class="">
<li id="info">There were some problems with your form submission:</li>
</ul>
<p id="success">Thanks for your message! We will get back to you ASAP!</p>
<form method="post" action="process.php">
<input type="text" id="name" name="name" value="" placeholder="NAME" required="required" autofocus="autofocus" />
<input type="email" id="email" name="email" value="" placeholder="EMAIL" required="required" />
<select id="enquiry" name="enquiry">
<option value="refrsh">Brand REFRSH</option>
<option value="consult">Brand Consultation</option>
<option value="support">Just a Hello!</option>
</select>
<textarea id="message" name="message" placeholder="MESSAGE" required="required" data-minlength="20"></textarea>
<span id="loading"></span>
<input type="submit" value="Holla!" id="submit-button" />
<p id="req-field-desc"><span class="required">*</span> kind of necessary</p>
</form>
</div>
</div><!-- end contact -->
#contact-form {
width: 690px;
padding:20px;
margin: 50px auto;
position:relative;
}
#contact-form h2 {
margin-bottom:20px;
margin-top:40px;
text-align: center;
}
#contact-form input,
#contact-form select,
#contact-form textarea,
#contact-form label {
font-size:15px;
margin-bottom:2px;
}
#contact-form input,
#contact-form select,
#contact-form textarea {
float: left !important;
width:320px;
margin-bottom:20px;
padding:4px;
}
#contact-form textarea {
height:150px;
resize: none;
}
#contact-form #message {
clear: both;
float: right !important;
}
#contact-form label {
display:block;
}
#contact-form .required {
font-weight:bold;
color:#F00;
}
#contact-form #submit-button {
width: 100px;
border: 2px solid #515151;
display:block;
float:rightright;
margin-bottom:0px;
margin-right:6px;
}
#contact-form #loading {
width:32px;
height:32px;
background-image:url(../img/loading.gif);
display:block;
position:absolute;
rightright:130px;
bottombottom:16px;
display:none;
}
#errors {
border:solid 1px #E58E8E;
padding:10px;
margin:25px 0px;
display:block;
width:437px;
-webkit-border-radius:8px;
-moz-border-radius:8px;
border-radius:8px;
background:#FFE6E6 url(../img/cancel_48.png) no-repeat 405px center;
display:none;
}
#errors li {
padding:2px;
list-style:none;
}
#errors li:before {
content: ' - ';
}
#errors #info {
font-weight:bold;
}
#errors #info:before {
content: '';
}
#success {
border:solid 1px #83D186;
padding:25px 10px;
margin:25px 0px;
display:block;
width:437px;
-webkit-border-radius:8px;
-moz-border-radius:8px;
border-radius:8px;
background:#D3EDD3 url(../img/accepted_48.png) no-repeat 405px center;
font-weight:bold;
display:none;
}
#errors.visible, #success.visible {
display:block;
}
#req-field-desc {
font-style:italic;
}
/* Remove box shadow firefox, chrome and opera put around required fields. It looks rubbish. */
input:required, textarea:required {
-moz-box-shadow:none;
-webkit-box-shadow:none;
-o-box-shadow:none;
box-shadow:none;
}
/* Normalize placeholder styles */
/* chrome, safari */
::-webkit-input-placeholder {
color:#CCC;
font-style:italic;
}
/* mozilla */
input:-moz-placeholder, textarea:-moz-placeholder {
color:#CCC;
font-style:italic;
}
/* ie (faux placeholder) */
input.placeholder-text, textarea.placeholder-text {
color:#CCC;
font-style:italic;
}
Updated JSFiddle: http://jsfiddle.net/jF49S/1/
As I mentioned in my comment, don't forget to utilize the CSS clear definition when dealing with float.
For instance, all that was needed here was a clear: left;.
#contact-form input,
#contact-form select,
#contact-form textarea {
clear:left;
float: left;
width:320px;
margin-bottom:20px;
padding:4px;
}
I also rearranged some of the HTML. Sometimes this is required to obtain the desired layout. For instance, I moved <textarea> to the beginning of the form in order for it to show up correctly.
Remember that, usually, there are many ways to accomplish a layout with HTML and CSS; my suggestion was just one way.
There are many articles and tutorials on float but here's a good primer: http://css-tricks.com/all-about-floats/

Resources