CSS Floated divs appearing below parent div - css

I'm trying to style a contact form based on this codepen and am having issues with the floated form going below its parent div instead of inside it. I have tried adding a clearfix with no luck. I've also messed around with the overflow a bit also with no luck. CSS is not my strong suit and I'm doing this in rails which complicates things so I'm pretty sure it's just something stupid that I'm missing. The generated HTML and my CSS is below and here is a fiddle where you can see what it's doing. I want the whole form to be in the white part, not below it. Thank you for any help you can provide!
HTML
<div id="contact">
<div id="contact-header">Contact Me</div>
<div id="form-main">
<div id="form-div">
<form accept-charset="UTF-8" action="/contacts" class="new_contact" id="new_contact" method="post">
<div style="display:none">
<input name="utf8" type="hidden" value="✓" />
<input name="authenticity_token" type="hidden" value="EoDahqxZMOLK9RYj8VfIO3lNh4EuGIcUZFv2+aWPj4Q=" />
</div>
<p class="name">
<input class="validate[required,custom[onlyLetter],length[0,100]] feedback-input" id="contact_name" name="contact[name]" placeholder="Name" type="text" />
</p>
<p class="email">
<input class="validate[required,custom[email]] feedback-input" id="contact_email" name="contact[email]" placeholder="Email" type="text" />
</p>
<p class="text">
<textarea class="validate[required,length[6,300]] feedback-input" id="contact_message" name="contact[message]" placeholder="Message"></textarea>
</p>
<div class="submit">
<input id="button-blue" name="commit" type="submit" value="SEND" />
</div>
</form>
</div>
</div>
</div>
<!--contact-->
CSS
#contact {
background-color: white;
}
#contact-header{
text-align:center;
font-size: 40px;
color: #FAF8F2;
padding-top: 30px;
}
#form-main{
width:100%;
float:left;
padding-top:0px;
}
#form-div {
background-color:#F0B49E;
padding: 35px 35px 50px 35px;
width: 450px;
float: left;
left: 50%;
position: absolute;
margin-top:30px;
margin-left: -260px;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
}
.feedback-input {
color:#3c3c3c;
font-family: "PT Sans", Helvetica, Arial, sans-serif;
font-weight:500;
font-size: 18px;
border-radius: 0;
line-height: 22px;
background-color: #FAF8F2;
padding: 13px 13px 13px 13px;
margin-bottom: 10px;
width:100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
border: 3px solid rgba(0,0,0,0);
}
.feedback-input:focus{
background: #fff;
box-shadow: 0;
border: 3px solid #A79C8E;
color: #A79C8E;
outline: none;
padding: 13px 13px 13px 54px;
}
.focused{
color:#30aed6;
border:#30aed6 solid 3px;
}
textarea {
width: 100%;
height: 150px;
line-height: 150%;
resize:vertical;
}
input:hover, textarea:hover,
input:focus, textarea:focus {
background-color:white;
}
#button-blue{
font-family: 'PT Sans', Arial, Helvetica, sans-serif;
float:left;
width: 100%;
border: #A79C8E solid 4px;
cursor:pointer;
background-color: #A79C8E;
color:white;
font-size:24px;
padding-top:22px;
padding-bottom:22px;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
margin-top:-4px;
font-weight:700;
}
#button-blue:hover{
background-color: #F0B49E;
}
.submit:hover {
color: #3498db;
}
.ease {
width: 0px;
height: 74px;
background-color: #FAF8F2;
-webkit-transition: .3s ease;
-moz-transition: .3s ease;
-o-transition: .3s ease;
-ms-transition: .3s ease;
transition: .3s ease;
}
.submit:hover .ease{
width:100%;
background-color:#A79C8E;
}

Ah...unfortunately, the floating only partially contributes to what you're experiencing. The usage of position: absolute on #form-div actually poses a much bigger problem (in my opinion).
Here are the CSS attributes that I would remove. The float and position attributes are used quite liberally, but I don't think there's a need for so many of them to get what you're looking for:
#form-main {
float:left;
}
#form-div {
float: left;
left: 50%;
position: absolute;
margin-top:30px;
margin-left: -260px;
}
#button-blue {
float:left;
}
And just one that I would add - this lets you easily center #form-div, without needing to apply negative margins or absolute positioning:
#form-div {
margin:30px auto 0;
}
Here's a JSFiddle with those styles commented out, and that last one added.
Since floats and absolute positioning take elements outside of the normal document flow, it can be tricky trying to achieve a desired layout without hard-coding a lot of values. In this case, that CSS was causing a lot of the elements' heights to be ignored, resulting in #contact not resizing to account for them. If you ever bump into a similar problem, try removing most/all of those types of styles, and working from the ground up - it can help a lot!
Hope this helps! Let me know if you have any questions.

Related

CSS positioning issue for chat conversation

I'm having issues with my CSS positioning for a conversation/chat page. Please see the code in this fiddle for my first attempt: https://jsfiddle.net/1gsykwL5/
Is there any way to make the div containing the 'logo' 100% height, so that the text (message) doesn't wrap underneath it? I've played around with position: absolute but it really screws up alignment.
I think there's probably a better way of coding it to be honest. But I'm not sure how. Can anybody please advise?
Thanks!
PS - code which includes the padding fix by Rick Jelier:
body{
font-family:arial;
}
.newchat {
padding: 10px;
}
.newdiv1 {
width: 50px;
height:100%;
float: left;
margin: 0px 10px 10px 0px;
}
.chat2 ul{
list-style: none;
padding:0px;
}
.chat2 ul li
{
border-radius: 5px;
}
.chat2 ul li:hover .thumbnail {
background: #bd6982;
}
.chat2 ul li .thumbnail {
display: inline-block;
background: #bfbfbf;
width: 50px;
color: #ffffff;
line-height: 50px;
text-align: center;
text-decoration: none;
-webkit-transition: background 0.3s linear 0s;
-moz-transition: background 0.3s linear 0s;
-ms-transition: background 0.3s linear 0s;
-o-transition: background 0.3s linear 0s;
transition: background 0.3s linear 0s;
border-radius: 50%;
}
.chat2 ul li:nth-child(2n) {
background: #f2f2f2;
}
.newdiv2 .meta {
color: #b3b3b3;
font-size: 12px;
padding-left: 60px;
}
.newdiv2 .meta a:hover {
text-decoration: underline;
}
.newdiv2 .meta a {
color: #999999;
text-decoration: none;
}
.newdiv2 h3 {
font-size:14px;
display: block;
width: 100%;
margin: 0px 0px 5px 0px;
color: #808080;
}
.newdiv2
{
font-size:12px;
color: #cccccc;
}
.newdiv2 .preview
{
display:block;
margin-bottom: 5px;
padding-left: 60px;
}
.otherUser
{
margin-left:30px;
}
<div class="chat2">
<ul>
<li>
<div class="newchat">
<div class="newdiv2">
<div class="newdiv1">
<a class="thumbnail" href="#">KS</a>
</div>
<h3>Kenny Sing</h3>
<span class="preview">make sure you take a look at the... ashiud hiuas hdiu huio hiu hiuo hiu hiu hio uhoiu hoi hui hoiouh
idsh ifu hisuod hfoiu hidsu hiu fhiuo dshiu hiuo hiou hiu hoiuhiohiuo hiu ohi uhiou hi ouhi iusdh fius dhuif hsdiuf hisdu fhusid f2f2f2 siudphf uisd h
osih doifh sidoh fiusd hiuf hdsiu hiu hiu</span>
<div class="meta">3h ago · Category · Reply</div>
</div>
</div>
</li>
<li class="otherUser">
<div class="newchat">
<div class="newdiv2">
<div class="newdiv1">
<a class="thumbnail" href="#">KS</a>
</div>
<h3>Kenny Sing</h3>
<span class="preview">make sure you take a look at the... ashiud hiuas hdiu huio hiu hiuo hiu hiu hio uhoiu hoi hui hoiouh
idsh ifu hisuod hfoiu hidsu hiu fhiuo dshiu hiuo hiou hiu hoiuhiohiuo hiu ohi uhiou hi ouhi</span>
<div class="meta">3h ago · Category · Reply</div>
</div>
</div>
</li>
</ul>
</div>
Try adding 60px of padding to the left of the textbox itself:
.newdiv2 .preview {
/* current css */
padding-left: 60px;
}
I tried it in the jsfiddle and it seems to work.
Hope this helps!
I see it in two ways:
position absolute of logo (+ top:10px, left:10px), and padding left + position relative to the container - with padding it shouldn't screw up your your alignment
or
Padding to the message container and negative margin to the logo
.newchat {
padding-left: 70px;
}
.newdiv1 {
margin: 0px 10px 10px -60px;
}
Less code more fun
Since you asked for leaner markup, this is how I'd approach it:
body {
background-color: #333;
}
.chat {
list-style-type: none;
}
.meta-message {
display: block;
color: #999;
margin-top: 5px;
}
.sender-message,
.reply-message {
background-color: #fff;
border-radius: 15px;
display: block;
font-family: sans-serif;
font-size: 20px;
line-height: 1.25;
max-width: 400px;
margin-bottom: 15px;
min-height: 60px;
padding: 15px 15px 15px 80px;
position: relative;
}
.sender-message::before,
.reply-message::before {
content: attr(data-shortname);
display: inline-block;
width: 50px;
height: 50px;
line-height: 50px;
position: absolute;
left: 15px;
top: 15px;
background-color: #a00;
text-align: center;
border-radius: 50%;
color: #fff;
}
.sender-message .name,
.reply-message .name {
color: #a00;
font-size: 28px;
margin: 0;
text-align: right;
}
.reply-message {
background-color: #eee;
margin-left: 80px;
}
.reply-message .name {
color: #0a0;
}
.reply-message::before {
background-color: #0a0;
}
<ol class="chat">
<li class="sender-message" data-shortname="kk">
<h3 class="name">Kenny King</h3>Is there any way to make the div containing the 'logo' 100% height, so that the text (message) doesn't wrap underneath it? I've played around with position: absolute but it really screws up alignment.<span class="meta-message">2016/12/13 12:41 p.m.</span>
</li>
<li class="reply-message" data-shortname="cw">
<h3 class="name">connexo websolutions</h3>Let's see how far we can get from a small codepen snippet...<span class="meta-message">2016/12/13 12:42 p.m.</span>
</li>
</ol>
https://codepen.io/connexo/pen/eBPXbd
Why did I use an ol?
Because a chat consists of a (typically chronologically) ordered list of messages (where order does matter).
I think you will be able to start from here and get to where you want to go.

How do I post an image inside of a search box?

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.

Css tabs position for ebay

I have been having troubles putting together some CSS tabs for ebay.
eBay (in UK anyway) now do not allow JS so I am trying to make some CSS ones. However, when create the tabs there is a problem with the positioning. Any content that goes below it is just overlapped.
I have tried absolute and fixed positioning but this does not fix the issue.
I have been going at this for days but cant seem to get anywhere.
Here is the jsfiddle
html:
<div id="wpl_wrapper">
<div id="wpl_store_header">
<div class="hotline">HOTLINE: 123 - 456 789</div>
<div class="clearfix"> </div>
</div>
<div class="main_section">
<h3 class="bar">[[product_title]]</h3>
<table>
<tbody>
<tr>
<td class="primary">
<div id="wpl_main_image">[[product_main_image]]</div>
<div id="wpl_list_images">[[additional_product_images]]</div>
</td>
<td class="wpl_description secondary">
<h2>[[product_title]]</h2>
<p class="long_desc">[[product_excerpt]]</p>
</td>
</tr>
</tbody>
</table>
<div class="section">
<p><span style="color: #ffffff;">.</span></p>
<ul class="tabs">
<li><input id="tab1" type="radio" checked="checked" name="tabs" /> <label for="tab1">Description</label>
<div class="tab-content animated fadeIn" id="tab-content1">The AT-X 116 PRO DX-II 11 16mm f/2.8 Lens for Canon Mount by Tokina is an ultra-wide angle auto-focus zoom lens with a fast f/2.8 aperture throughout the zoom range. The f/2.8 aperture guarantees fast shutter speeds, active auto-focus and minimal blur in low light situations. The AT-X 116 PRO DX-II lens is designed for digital cameras with APS-C-size CMOS or CCD sensors. Its angle of view ranges from 82-104º and it can focus as close as 11.81″ (0.3 m). Nine shutter blades in the aperture help to create soft out-of-focus backgrounds and two Super-Low Dispersion glass elements and two aspheric elements help to achieve this lens’ excellent contrast, sharpness and minimal chromatic aberration. As an update to their AT-X 116 PRO DX, Tokina has improved the multi-layer coatings to minimize light reflection and improve optical performance. The PRO DX-II has a silent focusing motor which is ideal if shooting video with your digital camera.
Tokina’s One-touch Focus Clutch Mechanism allows the photographer to switch between auto-focus and manual focus with a simple push of the focus ring. Snapping it forward into auto-focus and back into manual focus is all that needs be done, there’s no need to adjust the AF/MF switch on the camera body. This is a durable, bright, quality-optic AF lens.
Note! While the lens is designed for APS-C sized sensors it can work on full frame DSLR cameras as well, however some vignetting will occur.</div>
</li>
<li><input id="tab2" type="radio" name="tabs" /> <label for="tab2">What's Included</label>
<div class="tab-content animated fadeIn" id="tab-content2">[[meta_WHATSTAB]]</div>
</li>
<li><input id="tab3" type="radio" name="tabs" /> <label for="tab3">Specification</label>
<div class="tab-content animated fadeIn" id="tab-content3">[[meta_SPECTAB]]</div>
</li>
</ul>
</div>
<p><span style="color: #ffffff;">.</span></p>
<p><span style="color: #ffffff;">. </span></p>
<p><span style="color: #ffffff;"> .</span></p>
<div class="section">
<h3 class="bar">Shipping</h3>
<p><strong>Shipping cost:</strong><br /> <i>replace this text with your shipping information</i></p>
<p><strong>Delivery time:</strong><br /> <i>replace this text with your shipping information</i></p>
</div>
<div class="section">
<h3 class="bar">Payment</h3>
<p>We accept the following payment methods:</p>
<ul>
<li>first payment option</li>
<li>second payment option</li>
<li>third payment option</li>
</ul>
<p>Please contact us if you have any questions.</p>
</div>
<div class="section">
<h3 class="bar">Service</h3>
<p><i>replace this text with your service information</i></p>
</div>
<div class="section">
<h3 class="bar">Recent additions</h3>
<p>[[widget_new_listings]]</p>
</div>
<p><!-- #wpl_wrapper --></p>
css:
/* user colors */
#wpl_store_header .hotline {
color: $hotline_color;
background-color: $hotline_bgcolor;
display: $display_hotline;
}
#wpl_wrapper .wpl_description h2 {
color: $title_color;
}
#wpl_wrapper h3.bar {
color: $section_head_color;
background-color: $section_head_bgcolor_top;
background-image: -webkit-gradient(linear, left top, left bottom, from($section_head_bgcolor_top), to($section_head_bgcolor_bottom));
background-image: -webkit-linear-gradient(top, $section_head_bgcolor_top, $section_head_bgcolor_bottom);
background-image: -moz-linear-gradient(top, $section_head_bgcolor_top, $section_head_bgcolor_bottom);
background-image: -ms-linear-gradient(top, $section_head_bgcolor_top, $section_head_bgcolor_bottom);
background-image: -o-linear-gradient(top, $section_head_bgcolor_top, $section_head_bgcolor_bottom);
background-image: linear-gradient(to bottom, $section_head_bgcolor_top, $section_head_bgcolor_bottom);
}
/* layout */
#wpl_wrapper {
width: 780px;
margin-right: auto;
margin-left: auto;
margin-top: 30px;
margin-bottom: 20px;
padding: 10px;
font-size: 14px;
font-family:Arial,Helvetica,sans-serif;
}
#wpl_store_header {
width:100%;
overflow: hidden;
}
.wpl_description {
padding: 0 30px 10px 0;
}
#wpl_main_image {
height:370px;
width:370px;
}
#wpl_main_image img {
max-height:360px;
max-width:350px;
margin-top:0px;
}
/* image thumbnails - 3 columns */
#wpl_list_images {
text-align:center;
margin-top:10px;
}
#wpl_list_images a {
float:left;
display:block;
width:75px;
height:75px;
border: 1px solid #ccc;
margin-left:10px;
margin-right:10px;
margin-bottom:20px;
padding:12px;
}
#wpl_list_images img {
border:none;
max-height: 75px;
max-width: 75px;
width: auto;
}
#wpl_wrapper h2 {
font-size: 24px;
line-height: 30px;
}
#wpl_wrapper h3.bar {
margin-top: 30px;
margin-bottom: 20px;
padding-left: 10px;
height: 30px;
line-height: 30px;
font-size: 16px;
font-family: Helvetica, Arial, sans-serif;
-webkit-border-radius: $border_radius;
-moz-border-radius: $border_radius;
border-radius: $border_radius;
}
#wpl_store_header .logo {
float: left;
}
#wpl_store_header .hotline {
float: right;
height: 40px;
font-size: 16px;
line-height: 40px;
font-weight: bold;
padding-right: 20px;
padding-left: 20px;
margin-top: 7px;
-webkit-border-radius: $border_radius;
-moz-border-radius: $border_radius;
border-radius: $border_radius;
text-decoration: none;
text-shadow: 2px 2px 4px #713803;
filter: dropshadow(color=#713803, offx=0, offy=1);
}
#wpl_wrapper .clearfix {
clear:both;
}
#wpl_wrapper .main_section .primary{
/*width: 250px;*/
width: 50%;
vertical-align: top;
padding-right: 10px;
text-align: center;
}
#wpl_wrapper .main_section .secondary{
/*width: 490px;*/
width: 50%;
vertical-align: top;
padding-right: 10px;
font-size: 16px;
}
#wpl_wrapper .section p {
padding-left: 10px;
padding-right: 10px;
}
#wpl_wrapper .section big {
font-size: 18px;
font-weight: bold;
}
#wpl_wrapper .alignleft {
float: left;
}
#wpl_wrapper .alignright {
float: right;
}
/* these only apply in preview to override default styles from wp-admin */
body.wp-admin #wpl_wrapper ul {
list-style: disc inside none;
}
body.wp-admin #wpl_wrapper ul li {
padding-left: 2em;
}
/**
* CSS3 tabbed interface
* - based on http://www.sitepoint.com/css3-tabs-using-target-selector/
* - 1st tab is LAST in markup:
* - so it can be styled as active on page load
* - use combination of :target and ~ to override when another tab is clicked
*/
.tabs input[type=radio] {
position: absolute;
top: -9999px;
left: -9999px;
}
.tabs {
width: 650px;
float: none;
list-style: none;
position: relative;
padding: 0;
margin: 5px auto;
}
.tabs li{
float: left;
}
.tabs label {
display: block;
padding: 10px 20px;
border-radius: 2px 2px 0 0;
color: #3777be;
font-size: 16px;
font-weight: normal;
background: rgba(255,255,255,0.2);
cursor: pointer;
position: relative;
top: 3px;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.tabs label:hover {
background: rgba(255,255,255,0.5);
top: 0;
}
[id^=tab]:checked + label {
background: #3777be;
color: white;
top: 0;
}
[id^=tab]:checked ~ [id^=tab-content] {
display: block;
}
.tab-content{
z-index: 2;
display: none;
text-align: left;
width: 100%;
font-size: 20px;
line-height: 140%;
padding-top: 5px;
background: #fff;
border: 2px;
padding: 15px;
color: #000;
position: absolute;
top: 53px;
left: 0;
box-sizing: border-box;
-webkit-animation-duration: 0.5s;
-o-animation-duration: 0.5s;
-moz-animation-duration: 0.5s;
animation-duration: 0.5s;
}
Here is a workaround that may help: Use overflow:hidden; on .tab-content and declare a height on .tabs height:700px; (not great). Jsfiddle Found from CSS-Tricks

CSS Can't float left

Hi i have tried allot ways how to fix this, but i cant float div to left side. When i create div its automatically stacks in right top corner and i cant move it only with padding and margin.
My index.php example need to float:left div with class language:
<body class="menu">
<div class="wrapper">
<div class="menu-toggle">
Show menu
</div>
<div class="language">
Select lang
</div>
<header>
<nav class="menu-side">
<ul>
<li>Home</li>
<li>Login</li>
<li>Contact</li>
</ul>
</nav>
</header>
<form action="upload.php" method="POST" enctype="multipart/form-data" id="upload" class="upload">
<fieldset>
<legend>Upload files</legend>
<input type="file" id="file" name="file[]" required multiple>
<input type="submit" id="submit" name="submit" value="Upload">
</fieldset>
<div class="bar">
<span class="bar-fill" id="pb"><span class="bar-fill-text" id="pt"></span></span>
</div>
<div id="uploads" class="uploads">
Uploaded links will apear here.
</div>
</form>
</div>
<footer>
Created by Revix © 2014
</footer>
</body>
And my css is:
html, body { height: 100%; margin-top: 0; }
body { font-family: "Georgia", serif; }
.upload { width:500px; background: #f0f0f0; border: 1px solid #ddd; padding: 20px; vertical-align: center; margin-left: auto; margin-right: auto; }
.upload fieldset { border: 0; padding: 0; margin-bottom: 10px; }
.upload fieldset legend { font-size: 1.2em; margin-bottom: 10px; }
footer { background-color: cornflowerblue; text-align: center; vertical-align: middle; min-width: 542px; }
.wrapper { min-height: 100%; margin-bottom: -100px; clear: both; }
.wrapper:after { content: ""; display: block; }
.wrapper:after, footer { height: 100px; }
header { position: fixed; margin-left: auto; margin-right: auto; }
.uploads a, .uploads span { display: block; }
.bar { width: 100%; background: #eee; padding: 3px; margin-bottom: 10px; box-shadow: inset 0 1px 3px rgba(0,0,0,.2); border-radius: 3px; box-sizing:border-box; }
.bar-fill { height: 20px; display: block; background: cornflowerblue; width: 0; border-radius: 3px;
-webkit-transition:width 0.8s ease; -moz-transition:width 0.8s ease; -o-transition:width 0.8s ease; transition:width 0.8s ease; }
.bar-fill-text { color:#fff; padding: 3px; }
.language { float: left; position: absolute; width: 80px; padding: 3px; }
If you wanna to see my web site: Here
Can you suggest me what to do?
Do you mean this effect? Please see my demo.
Please paste your code to jsbin.com next time. Otherwise it's not convenient for us to resolve your problem.
http://jsbin.com/yivat/1
float:left and position:absolute doesn't work.
remove position:absolute
.language { float: left; width: 80px; padding: 3px; }
Inspecting these elements in my browser they have all the CSS attribute position:absolute; set, which sets them at a absolute position within the window. But these elements seem to have no left and top position set which sets you all elements to window position 0,0 which is left top corner.
I would recommend to set the position to relative position:relative; or define specific positions for your html elements.
Floating left on a absolute positioned element will not work. Try relative to float it or position it on your page with top:px left:px;

Text disappeared from buttons

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;
}

Resources