CSS change when specific radio button is checked using :checked pseudo class - css

The code below will allow me to alter the css of any sibling div element when the checkbox is checked:-
input[type="radio"]:checked ~ div{
display:none;
}
What i need to do is target a specific div either by its Id or its class when a specific radio button in the list is checked.
I want to try and to this Purely in CSS.
Ive tried doing this :-
input[type="radio"]:checked ~ #one.div{
display:none;
}
https://codepen.io/dyk3r5/pen/WOmxpV?editors=1111
<div class="container">
<input type="radio" id="opt1" name="radiolist" checked>
<label for='opt1'>New Account</label>
<input type="radio" id="opt2" name="radiolist">
<label for='opt2'>Existing Account</label>
<div id="one">Lorem Ipsum 1</div>
<div id="two">Lorem Ipsum 2</div>
</div>
html, body{
height :100%;
}
.container{
display:flex;
justify-content:center;
}
label{
color:#000;
font-weight:600;
height: 25px;
padding: 5px 10px;
border-bottom: 2px solid lightgrey;
margin: 5px 1px;
}
input[type="radio"]{
display:none;
}
input[type="radio"]:checked + label{
border-bottom: 2px solid red;
}
input[type="radio"]:checked ~ div{
display:none;
}

I updated the css to display the corresponding div when a certain radio button is selected. The problem is your selector for the div: #one.div. This targets the element with id "one" and class "div". It should be div#one instead.
html,
body {
height: 100%;
}
.container {
display: flex;
justify-content: center;
}
label {
color: #000;
font-weight: 600;
height: 25px;
padding: 5px 10px;
border-bottom: 2px solid lightgrey;
margin: 5px 1px;
}
input[type="radio"] {
display: none;
}
input[type="radio"]:checked+label {
border-bottom: 2px solid red;
}
input[type="radio"]~div {
display: none;
}
input[type="radio"][id="opt1"]:checked~div#one,
input[type="radio"][id="opt2"]:checked~div#two {
display: block;
}
<div class="container">
<input type="radio" id="opt1" name="radiolist" checked>
<label for='opt1'>New Account</label>
<input type="radio" id="opt2" name="radiolist">
<label for='opt2'>Existing Account</label>
<div id="one">Lorem Ipsum 1</div>
<div id="two">Lorem Ipsum 2</div>
</div>

Related

Is there a way for the content inside a border box to stay on it's place while the border's of the box in the background is changing width?

s there a way for the content inside a border-box to stay in its place while the border of the box in the background is changing width? I'm using radio buttons for a carousel and now I'm decorating it to look like box buttons. Currently, I have a left border turn into a right border (kinds of like drawers opening), but then the icons (the content I placed inside the 'box buttons') get dragged while the borders are moving. I want it to stay in place looking at how it is on hover so I tried using :before for the borders but then it didn't work.
[class^="panel_"] {
overflow: auto;
position: relative;
width: inherit;
height: inherit;
padding: 8%;
}
[class^="label_"] {
display: flex;
margin: 5px;
width: 32px;
height: 32px;
line-height: 32px;
justify-content: center;
align-items: center;
color: #c5c8d3;
background-color: transparent;
border: 1.5px solid #c5c8d3;
border-style: none none none solid;
transition: all 0.5s ease;
}
[class^="label_"]:hover {
color: #496676;
background-color: transparent;
border-color: #c5c8d3;
}
#button_home:checked~#navigation .label_home,
#button_compilation:checked~#navigation .label_compilation,
#button_about_me:checked~#navigation .label_about_me,
#button_code:checked~#navigation .label_code {
border-style: solid solid solid none;
animation: tab 1s ease-in-out forwards;
}
#keyframes tab {
from {
width: 0px;
background-color: transparent;
border-color: #c5c8d3;
color: #496676;
}
to {
width: 32px;
color: #496676;
background-color: #fff2f2;
border-color: #496676;
}
}
<head>
<link href="//solrainha.github.io/honeybee/honeybee.css" rel="stylesheet">
</head>
<body>
<input hidden type="radio" name="carousel-control" id="button_home" checked />
<input hidden type="radio" name="carousel-control" id="button_compilation" />
<input hidden type="radio" name="carousel-control" id="button_about_me" />
<input hidden type="radio" name="carousel-control" id="button_code" />
<div id="navigation">
<label for="button_home" class="label_home"><span class="th th-heart-1-o"></span> </label>
<label for="button_compilation" class="label_compilation"><span class="th th-folder-3-o"></span></label>
<label for="button_about_me" class="label_about_me"><span class="th th-eyelash"></span></label>
<label for="button_code" class="label_code"><span class="th th-code"></span></label>
</div>
</body>
Use pseudo element:
[class^="label_"] {
display: flex;
margin: 5px;
width: 32px;
height: 32px;
line-height: 32px;
justify-content: center;
align-items: center;
color: #c5c8d3;
position:relative;
overflow:hidden;
}
[class^="label_"]::before {
content:"";
position:absolute;
z-index:-1;
top:0;
left:0;
right:0;
bottom:0;
background-color: #fff2f2;
border: 1.5px solid #496676;
border-left:0;
transition: all 0.5s ease;
transform:translateX(calc(1.5px - 100%)); /* hide all the element and show only one border */
}
[class^="label_"]:hover {
color: #496676;
background-color: transparent;
border-color: #c5c8d3;
}
#button_home:checked~#navigation .label_home::before,
#button_compilation:checked~#navigation .label_compilation::before,
#button_about_me:checked~#navigation .label_about_me::before,
#button_code:checked~#navigation .label_code::before {
transform:translateX(0); /* show the element on click */
}
#button_home:checked~#navigation .label_home,
#button_compilation:checked~#navigation .label_compilation,
#button_about_me:checked~#navigation .label_about_me,
#button_code:checked~#navigation .label_code {
color:#496676;
}
<head>
<link href="//solrainha.github.io/honeybee/honeybee.css" rel="stylesheet">
</head>
<body>
<input hidden type="radio" name="carousel-control" id="button_home" checked />
<input hidden type="radio" name="carousel-control" id="button_compilation" />
<input hidden type="radio" name="carousel-control" id="button_about_me" />
<input hidden type="radio" name="carousel-control" id="button_code" />
<div id="navigation">
<label for="button_home" class="label_home"><span class="th th-heart-1-o"></span> </label>
<label for="button_compilation" class="label_compilation"><span class="th th-folder-3-o"></span></label>
<label for="button_about_me" class="label_about_me"><span class="th th-eyelash"></span></label>
<label for="button_code" class="label_code"><span class="th th-code"></span></label>
</div>
</body>

Is it possible to create vertical text that spans all rows in a CSS Grid?

Looking to create a section header for a grid (instead of taking up vertical space by having it above the section), like so:
It's easy of course to have the first column span the rows with grid-rows: 1 / span 3 but then if I transform the text and align/justify it, the div doesn't take up the full space of the column, so setting backgrounds/borders doesn't look right.
See trial pen
body {
padding: 1em;
font-family: sans-serif;
}
.my-grid {
display: grid;
grid-template-columns: 2rem 100px 10rem;
background-color: #eee
}
.my-grid>* {
border: 1px solid #ccc;
}
.section-title {
grid-row: 1 / span 5;
align-self: center;
justify-self: center;
transform: rotate(270deg);
background-color: papayawhip;
text-transform: uppercase;
}
input {
border: 2px solid #000;
}
<div class="my-grid">
<div class="section-title">Address</div>
<div>Address 1</div>
<input type="text">
<div>Address 2</div>
<input type="text">
<div>City</div>
<input type="text">
<div>State</div>
<input type="text">
<div>Zip Code</div>
<input type="text">
</div>
Yes, using writing-mode
The writing-mode CSS property defines whether lines of text are laid out horizontally or vertically and the direction in which blocks progress.
MDN
body {
padding: 1em;
font-family: sans-serif;
}
.my-grid {
display: grid;
grid-template-columns: 2rem 100px 10rem;
background-color: #eee
}
.my-grid>* {
border: 1px solid #ccc;
}
.section-title {
grid-row: 1 / span 5;
text-align: center;
writing-mode:vertical-rl; /* vertical text */
line-height:2rem; /* center in div */
transform:rotate(180deg); /* spin to orient as required */
background-color: papayawhip;
text-transform: uppercase;
}
input {
border: 2px solid #000;
}
<div class="my-grid">
<div class="section-title">Address</div>
<div>Address 1</div>
<input type="text">
<div>Address 2</div>
<input type="text">
<div>City</div>
<input type="text">
<div>State</div>
<input type="text">
<div>Zip Code</div>
<input type="text">
</div>

Pure CSS Thumbnail viewer, but problems with placement

I have a pure CSS image script I use with my eBay listings, I'm changing the design of my template at the moment and have run into a major snag with the code, it seems that the large image can only be displayed directly below the thumbnail radio buttons, but I want to have the large image being displayed in a different table cell..
I don't know a great deal about CSS, so hopefully someone will know an easy fix? here's hoping..
<style type="text/css">
div.Image1BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image1_zpsus8mlxre.jpg'); background-size: 110px 92px; }
div.Image2BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image2_zpsetwycsgp.jpg'); background-size: 110px 92px; }
div.Image3BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image3_zpsxtx5woeg.jpg'); background-size: 110px 92px; }
div.Image4BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 110px 92px; }
div.Image5BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 110px 92px; }
div.Image1BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image1_zpsus8mlxre.jpg'); background-size: 600px 500px; }
div.Image2BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image2_zpsetwycsgp.jpg'); background-size: 600px 500px; }
div.Image3BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image3_zpsxtx5woeg.jpg'); background-size: 600px 500px; }
div.Image4BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
div.Image5BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
section {
display: none;
}
input {
display: none;
}
label {
display: inline-block;
font-weight: 600;
color: #bbb;
border: 1px solid transparent;
}
label:hover {
cursor: hand;
border: 1px solid #1F7AB6;
box-shadow: 2px 2px 7px #d0d0d0;
}
label {
margin: 0px 5px 0px 0px;
}
input:checked + label {
border: 1px solid #155179;
box-shadow: 2px 2px 7px #c0c0c0;
}
#tab1:checked ~ #content1,
#tab2:checked ~ #content2,
#tab3:checked ~ #content3,
#tab4:checked ~ #content4,
#tab5:checked ~ #content5 {
display: block;
}
</style>
<table border=1><tr><td>
<input id="tab1" type="radio" name="tabs" checked>
<label for="tab1"><div class="Image1BlockS"></div></label>
<input id="tab2" type="radio" name="tabs">
<label for="tab2"><div class="Image2BlockS"></div></label>
<input id="tab3" type="radio" name="tabs">
<label for="tab3"><div class="Image3BlockS"></div></label>
<input id="tab4" type="radio" name="tabs">
<label for="tab4"><div class="Image4BlockS"></div></label>
<input id="tab5" type="radio" name="tabs">
<label for="tab5"><div class="Image5BlockS"></div></label>
<section id="content1">
<div class="Image1BlockB"></div>
</section>
<section id="content2">
<div class="Image2BlockB"></div>
</section>
<section id="content3">
<div class="Image3BlockB"></div>
</section>
<section id="content4">
<div class="Image4BlockB"></div>
</section>
<section id="content5">
<div class="Image5BlockB"></div>
</section>
</td></tr></table>
I need to rewrite it so that I can put the large image anywhere
throughout the template and still be able to have the small thumbnails
change it when they're clicked.
Well if this is the case then you can experiment with the positioning.
On the other hand you can imitate the table behavior with display: table and td with display: table-cell to get you closer to the desired result.
* {margin:0;padding:0;box-sizing:border-box}
html, body {width:100%}
div.Image1BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image1_zpsus8mlxre.jpg'); background-size: 110px 92px; }
div.Image2BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image2_zpsetwycsgp.jpg'); background-size: 110px 92px; }
div.Image3BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image3_zpsxtx5woeg.jpg'); background-size: 110px 92px; }
div.Image4BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 110px 92px; }
div.Image5BlockS { width:110px; height:92px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 110px 92px; }
div.Image1BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image1_zpsus8mlxre.jpg'); background-size: 600px 500px; }
div.Image2BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image2_zpsetwycsgp.jpg'); background-size: 600px 500px; }
div.Image3BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image3_zpsxtx5woeg.jpg'); background-size: 600px 500px; }
div.Image4BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
div.Image5BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
div.Image4BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
div.Image5BlockB { width:600px; height:500px; background-image:url('https://i1066.photobucket.com/albums/u409/magneato1/image4_zpsixuqksa5.jpg'); background-size: 600px 500px; }
#table {
display: table; /* imitates the table behavior */
border: 1px solid;
border: 1px outset grey;
padding: 1px;
}
.table-cell {
margin: 1;
border: thin inset grey;
display: table-cell;
}
section {
display: none;
}
input {
display: none;
}
label {
display: inline-block;
font-weight: 600;
color: #bbb;
border: 1px solid transparent;
}
label:hover {
cursor: hand;
border: 1px solid #eee;
box-shadow: 1px 1px 5px #000;
}
label {
margin: 0 5px 0 0;
}
input:checked + label {
border: 1px solid #155179;
box-shadow: 2px 2px 7px #c0c0c0;
}
#tab1:checked ~ #content1,
#tab2:checked ~ #content2,
#tab3:checked ~ #content3,
#tab4:checked ~ #content4,
#tab5:checked ~ #content5 {
display: table-cell; /* imitates the td behavior */
border: thin inset grey;
margin: 1;
}
<div id="table">
<tr>
<td>
<input id="tab1" type="radio" name="tabs" checked>
<label for="tab1"><div class="Image1BlockS"></div></label>
<input id="tab2" type="radio" name="tabs">
<label for="tab2"><div class="Image2BlockS"></div></label>
<input id="tab3" type="radio" name="tabs">
<label for="tab3"><div class="Image3BlockS"></div></label>
<input id="tab4" type="radio" name="tabs">
<label for="tab4"><div class="Image4BlockS"></div></label>
<input id="tab5" type="radio" name="tabs">
<label for="tab5"><div class="Image5BlockS"></div></label>
</td>
<div class="table-cell">
2nd cell
</div>
<td>
3rd cell with the td element but without the border which doesn't work if there's no table element
</td>
<div class="table-cell">
4th cell
</div>
<section id="content1">
<div class="Image1BlockB"></div>
</section>
<section id="content2">
<div class="Image2BlockB"></div>
</section>
<section id="content3">
<div class="Image3BlockB"></div>
</section>
<section id="content4">
<div class="Image4BlockB"></div>
</section>
<section id="content5">
<div class="Image5BlockB"></div>
</section>
</tr>
</div>
This is essentially what I want to do, but putting the large image elements into another cell breaks it, the large image no longer shows up, I need to rewrite it so that I can put the large image anywhere throughout the template and still be able to have the small thumbnails change it when they're clicked on.
<table border=1><tr><td>
<input id="tab1" type="radio" name="tabs" checked>
<label for="tab1"><div class="Image1BlockS"></div></label>
<input id="tab2" type="radio" name="tabs">
<label for="tab2"><div class="Image2BlockS"></div></label>
<input id="tab3" type="radio" name="tabs">
<label for="tab3"><div class="Image3BlockS"></div></label>
<input id="tab4" type="radio" name="tabs">
<label for="tab4"><div class="Image4BlockS"></div></label>
<input id="tab5" type="radio" name="tabs">
<label for="tab5"><div class="Image5BlockS"></div></label>
</td>
<td>
<section id="content1">
<div class="Image1BlockB"></div>
</section>
<section id="content2">
<div class="Image2BlockB"></div>
</section>
<section id="content3">
<div class="Image3BlockB"></div>
</section>
<section id="content4">
<div class="Image4BlockB"></div>
</section>
<section id="content5">
<div class="Image5BlockB"></div>
</section>
</td>
</tr></table>

Why height text box is less than button?

Why height text box is less than button?
My Code :
#container {
overflow: auto;
line-height: 100%;
border: 1px solid red;
}
.t,#but {
float: left;
}
#but ,.txt {
border: 1px solid #999;
padding: 10px;
font-size: 20px;
}
<div id="container">
<div class="t">
<input type="text" class="txt" name="">
</div>
<div id="but"><span>Search</span></div>
</div>
The <input> element, is one of the replaced elements, and In CSS, a replaced element is an element whose representation is outside the scope of CSS. It has some special styles from browser user agent stylesheet, and they don't get inherited by default, such as font-family, font-size, line-height etc., and those rules can determine a box's height.
You can force them to get inherited by setting <property>: inherit;, so that the <input type="text"> can inherit those styles from <div class="t"> and its parent <div id="container"> etc., so it will be able to get the same style as the <div id="but">, in order to make them the same height.
You can set those specific styles on the input box directly, but using inherit can prevent from overriding rules.
#container {
font-size: 20px;
overflow: auto;
}
.t,
#but {
float: left;
}
.txt {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
.txt,
#but {
border: 1px solid #999;
padding: 10px;
}
<div id="container">
<div class="t">
<input type="text" class="txt" name="">
</div>
<div id="but"><span>Search</span></div>
</div>
In addition, you will use a <button> tag instead of <div> button in the real case I think. To make the input field and button the same height, you will also need to set the same padding values for them directly.
#container {
font-size: 20px;
overflow: auto;
}
.t,
#but {
float: left;
}
.txt,
#but {
font-family: inherit;
font-size: inherit;
line-height: inherit;
border: 1px solid #999;
padding: 10px;
}
<div id="container">
<div class="t">
<input type="text" class="txt" name="">
</div>
<button id="but"><span>Search</span></button>
</div>
Browser handles difference html element and attribute differently i check it computed tab in chrome developer tool and find out input field render height differently 1 px more in top and bottom so its 2 px actual height you set.
these line will fix your problem, check the snippet for how to apply them.
font-size:16px;
line-height:16px;
height:16px;
font-family:sans-serif;
#container {
overflow: auto;
line-height: 100%;
border: 1px solid red;
}
.t,#but {
float: left;
}
#but ,.txt {
border: 1px solid #999;
padding: 10px;
font-size:16px;
line-height:16px;
height:16px;
font-family:sans-serif;
}
<div id="container">
<div class="t">
<input type="text" class="txt" name="" placeholder="write a name" />
</div>
<div id="but"><span>Search</span></div>
</div>
/You'll need to do something like this although there is likely to be some differences across systems./
.searchtext {
border:1px solid #000;
border-right:none;
padding:4px;
margin:0px;
float:left;
height:16px;
overflow:hidden;
line-height:16px;
}
.searchbutton {
border:1px solid #000;
background:#fd0;
vertical-align:top;
padding:4px;
margin:0;
float:left;
height:26px;
overflow:hidden;
width:5em;
text-align:center;
line-height:16px;
}
Try giving font-size to all your elements, they will become of equal height.
#container {
overflow: auto;
line-height: 100%;
border: 1px solid red;
}
.t,
#but {
float: left;
}
#but,
.txt {
border: 1px solid #999;
padding: 10px;
font-size: 14px;
}
<div id="container">
<div class="t">
<input type="text" class="txt" name="">
</div>
<div id="but"><span>Search</span></div>
</div>
The problem is your font-size.
Please try to give font-size to all your elements like in the following fiddle:
#container {
overflow: auto;
line-height: 100%;
border: 1px solid red;
}
.t,
#but {
float: left;
}
#but,
.txt {
border: 1px solid #999;
padding: 10px;
font-size: 14px;
}
<div id="container">
<div class="t">
<input type="text" class="txt" name="">
</div>
<div id="but"><span>Search</span></div>
</div>
This is not valid selector:
line-height: 100%;
You have to define height to container, or wrap your inner content with:
.container .wrap{
position: relative;
display: inline-block;
width: 100%;
height: 100%;
}
And then set height: 100% to your #but element.

Inline-block not working

http://jsfiddle.net/9FG4f/4/
I tried a different way to line up the labels and textfields in the form area along with the button horizontally, but the email label and txtfield is not aligned perfectly.
HTML
<div class="prefill2">
<h1>Need a Real Estate Expert?</h1>
<form class="action3" name="form1" method="POST" action="_sendmail.php" onSubmit="return CheckAll(this);">
<div id="action3-fname">
<label class="nick-3">Full Name:</label>
<input type="text" class="name2" name="full_name" />
</div>
<div id="action3-email">
<label class="nick-4">Email Address:</label>
<input type="text" class="email2" name="email">
</div>
<div id="action3-button">
<input type="submit" class="btn2" value="JOIN NOW" name="submit">
</div>
</form>
</div>
CSS
#action3-fname {
display:inline-block;
}
#action3-email {
display:inline-block;
}
#action3-button {
display:inline-block;
}
.action3 .name2 {
border:thin #999 solid;
border-radius:5px;
float:left;
height:22px;
margin-bottom:10px;
margin-left: 1px;
margin-top: 8px;
padding: 4px;
width: 210px;
}
.action3 .email2 {
border: thin #999 solid;
border-radius: 5px;
height: 22px;
margin-left: 22px;
margin-top: -8px;
padding: 4px;
width: 210px;
}
.action3 .nick-3 {
color:#000000;
}
.action3 .nick-4 {
margin-left:23px;
color:#000000;
}
.action3 .btn2 {
background: none repeat scroll 0 0 #ff8400;
border: medium none;
border-radius: 5px;
color: #FFFFFF;
cursor: pointer;
font-size: 22px;
font-weight: bold;
height: 40px;
margin-bottom: 15px;
text-align: center;
width: 140px;
margin-left:10px;
}
I'd get rid of the floats and the margin-tops. Like so:
.action3 .email2 {
border: thin #999 solid;
border-radius: 5px;
height: 22px;
margin-left: 22px;
padding: 4px;
width: 210px;
}
Here's a fiddle: http://jsfiddle.net/disinfor/9FG4f/8/
EDIT
Updated with fiddle that closes all tags correctly and combines the first three lines of CSS into a class.
.actionClass {
display:inline-block;
}
<div class="prefill2">
<h1>Need a Real Estate Expert?</h1>
<form class="action3" name="form1" method="POST" action="_sendmail.php" onSubmit="return CheckAll(this);">
<div id="action3-fname" class="actionClass">
<label class="nick-3">Full Name:</label><br />
<input type="text" class="name2" name="full_name" />
</div>
<div id="action3-email" class="actionClass">
<label class="nick-4">Email Address:</label><br />
<input type="text" class="email2" name="email" />
</div>
<div id="action3-button" class="actionClass">
<input type="submit" class="btn2" value="JOIN NOW" name="submit" />
</div>
</form>
</div>
Get rid of the <br>, get rid of the float's and it should all line up nicely.
.action3 .name2 {
border:thin #999 solid;
border-radius:5px;
/* float:left; <-- remove this */
height:22px;
margin-bottom:10px;
margin-left: 1px;
margin-top: 8px;
padding: 4px;
width: 210px;
}
Here is your updated fiddle
I actually made them float left and corrected a couple margins. Button and everything lined up together.
Here's my updated fiddle
#action3-fname {
float:left;
}
#action3-email {
float:left;
}

Resources