Horizontal Radio Buttom Custom Design - html

I been trying to reach this design radio button design with no success
I'm using bootstrap for my site, but all I can reach is this:
This is my code:
.content {background-color: #42d5b9; padding: 50px}
.amount-landing {text-align: center;}
.amount-landing label {color: #FFFFFF;}
.amount-landing > .col-xs-2 {background: url(https://i.imgur.com/K8Nz8Y2.png) repeat-x; background-position: 0 12px;}
.amount-landing input[type="radio"] {
display:none;
}
.amount-landing input[type="radio"] + label span {
display:inline-block;
width:15px;
height:15px;
margin:0px 0px 0 0;
vertical-align:middle;
background: #FFFFFF;
cursor:pointer;
border-radius: 50%;
}
.amount-landing input[type="radio"]:checked + label span {
background: #101B27;
}
<div class="content ">
<div class="form-group">
<div class="row amount-landing gray-line">
<div class="col-xs-2 col-xs-offset-1"><input type="radio"><label for="amount1"><span></span></label></div>
<div class="col-xs-2"><input type="radio"><label for="amount2"><span></span></label></div>
<div class="col-xs-2"><input type="radio"><label for="amount3"><span></span></label></div>
<div class="col-xs-2"><input type="radio"><label for="amount4"><span></span></label></div>
<div class="col-xs-2"><input type="radio"><label for="amount5"><span></span></label></div>
</div>
<!-- This shows radio buttons -->
<div class="row text-center" style="font-size: 14px;color: #FFFFFF;line-height: 14px;">
<div class="col-xs-1"></div>
<div class="col-xs-2">0$</div>
<div class="col-xs-2">1$<br>-<br>1000$</div>
<div class="col-xs-2">1001$<br>-<br>2001$</div>
<div class="col-xs-2">2001$<br>-<br>3000$</div>
<div class="col-xs-2">More than<br>3000$</div>
<div class="col-xs-1"></div>
</div>
<!-- This shows numbers -->
</div>
</div>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
So, the code is basically some cols with the radio buttons and labels for making a custom radio button, then I applied a gray line (is an img) to all cols in the first row for making possible showing the background line but this method covers all the column background; then in another row put the amount labels, this also have responsive issues when you shrink the screen the amount labels gets too close each other.
Help would appreciated to light my path, thank you.

Use id and name attributes for your input type="radio". Radio buttons with the same name can only be used as one "group." No need to use 'span' inside 'labels'.
White background line is styled using CSS pseudo element ":after". No need to use background images. In order to avoid the background line expanding beyond the last radio button, made "content" property to none for the last div. This is achieved using CSS pseudoclass ":last-of-type".
.content {background-color: #42d5b9; padding: 50px;}
.amount-landing {text-align: center;}
.amount-landing label {color: #FFFFFF;}
.amount-landing .amount-col {
position: relative;}
.amount-landing .amount-col:after {
content: "";
position:absolute;
width: 100%;
height: 2px;
background-color: #fff;
top: 50%;
}
.amount-landing .amount-col:last-of-type:after {
content: none;
}
.amount-landing input[type="radio"] {
display:none;
}
.amount-landing input[type="radio"] + label {
display:inline-block;
width: 20px;
height:20px;
margin:0px 0px 0 0;
vertical-align:middle;
background: #FFFFFF;
cursor:pointer;
border-radius: 50%;
}
.amount-landing input[type="radio"]:checked + label {
background: #101B27;
}
<div class="content ">
<div class="form-group">
<div class="row amount-landing gray-line">
<div class="col-xs-2 col-xs-offset-1 amount-col"><input type="radio" id="amount1" name="amount"><label for="amount1"></label></div>
<div class="col-xs-2 amount-col"><input type="radio" id="amount2" name="amount"><label for="amount2"></label></div>
<div class="col-xs-2 amount-col"><input type="radio" id="amount3" name="amount"><label for="amount3"></label></div>
<div class="col-xs-2 amount-col"><input type="radio" id="amount4" name="amount"><label for="amount4"></label></div>
<div class="col-xs-2 amount-col"><input type="radio" id="amount5" name="amount"><label for="amount5"></label></div>
</div>
<!-- This shows radio buttons -->
<div class="row text-center" style="font-size: 13px;color: #FFFFFF;line-height: 15px;">
<div class="col-xs-1"></div>
<div class="col-xs-2">0$</div>
<div class="col-xs-2">1$-1000$</div>
<div class="col-xs-2">1001$-2001$</div>
<div class="col-xs-2">2001$-3000$</div>
<div class="col-xs-2">More than 3000$</div>
<div class="col-xs-1"></div>
</div>
<!-- This shows numbers -->
</div>
</div>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

Related

CSS: Hovering over child of element should affect different element

I want users to be able to hover over a button within a different div, which then changed the background-color of the div below.
My current code is as followed:
.delSeperator button:hover+.linkField {
background-color: rgba(255, 0, 0, 0.2);
}
.seperator {
color: #000000;
background-color: #e4e8eb;
min-height: 0.5rem;
margin: 1rem 0rem 1rem 0rem;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div id="delSeperator_0" class="row delSeperator">
<div class="col-xs-10 mb-0">
<div class='seperator vertical-center'></div>
</div>
<div class="col-xs-1 mb-0"><button type="button" class="btn btn-danger" onclick="delField('linkField', this.closest('.row')); delField('delSeperator', this.closest('.row'));"><i class="fa fa-minus" aria-hidden="true"></i></button></div>
</div>
<div class="row linkField" id="linkField_0">
<div class="col-xs-6 mb-0">
<div class="form-group"><label for="txt_link[0]["bezeichnung"]" class="">Bezeichnung</label><input id="txt_link[0]["bezeichnung"]" type="text" maxlength="200" name="link[0]["bezeichnung"]" class="form-control"></div>
</div>
<div class="col-xs-6 mb-0">
<div class="form-group"><label for="txt_link[0]["url"]" class="">URL</label><input id="txt_link[0]["url"]" type="url" maxlength="500" name="link[0]["url"]" class="form-control"></div>
</div>
</div>
Changing the Hover-CSS to
.delSeperator:hover + .linkField {
background-color: rgba(255,0,0,0.2);
}
works so that when you hover over the whole .delSeperator, the .linkField gets the background property.
When I change the code to
.delSeperator button:hover {
background-color: rgba(255,0,0,0.2);
}
it works so that when you hover over the button, the button gets the background property.
But I can't seem to combine these two. Is there any way to achieve what I need?
You can workaround this issue by playing with the pointer-events property
i got this to work with the following CSS:
.delSeperator:hover + .linkField {
background-color: rgba(255,0,0,0.2);
}
.delSeperator {
pointer-events: none
}
.delSeperator button {
pointer-events: initial
}

Two columns same height - Bootstrap - CSS

Currently I'm creating a product box with two columns near each other, left one have the product image and right one product description.
The main problem is, I'm trying to make the product description the same height as the image, but after few tries I didn't get close to solve it, because it needs to be responsive. I tried a lot of solutions but still stuck, the closest one was using media queries and apply height to the .product-det but seems like it's not the good way.
I have create a Bootply as a demo.
The blue border must reach the bottom of the wrapper.
HTML
<div class="container">
<div class="col-xs-6">
<div class="col-xs-12 padding-15 margin-b-15 border-default padding-t-0 padding-b-0">
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-xs-4 col-sm-3 nopadding">
<img class="img-responsive" src="http://placehold.it/250x250">
</div>
<div class="col-xs-8 col-sm-9 border-l-default">
<div class="row"> <h4 class="col-xs-10 margin-t-15 text-ellipsis">Article pokeball superpotion lighting boltubertext pokemon pikachu</h4>
<div
class="col-xs-2 padding-t-15"> <span class="pointer pull-right">
<i class="glyphicon glyphicon-remove"></i>
</span>
</div>
<div class="product-det col-xs-12 line-h-35">
<div class="row">
<div class="col-xs-4">ITEMID</div>
<div class="col-xs-4">
<div class="input-group">
<input class="form-control" placeholder="qnt" type="text"> <span class="input-group-btn">
<button class="btn btn-secondary" type="button">
<span class="glyphicon glyphicon-refresh"></span>
</button>
</span>
</div>
</div>
<div class="col-xs-4"><span class="pull-right">3.203 €</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="">Right content</div>
</div>
CSS
.text-ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.padding-15 {
padding: 15px;
}
.padding-t-15 {
padding-top: 15px;
}
.margin-b-15 {
margin-bottom: 15px;
}
.border-default{
border: 1px solid #e0e0e0;
}
.padding-t-0 {
padding-top: 0px;
}
.padding-b-0 {
padding-bottom: 0px;
}
.nopadding {
padding: 0;
}
.line-h-35 {
line-height: 35px;
}
.border-l-default {
border-left: 1px solid blue;
}
Try the following:
Html:
<div class="row row-eq-height">
<!--The div columns you want them to be same height should be here-->
</div>
CSS:
/*
Row with equal height columns
*/
.row-eq-height {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
you can try javascript to do this. because bootstrap col is changing width overtime when you change your devices. I like it, it typeless and you can put the class in your image wrap and your product descript wrap like so:
var st = $('.squarethis').width();
$('.squarethis').css({'height':st+'px'});
$('.sameheight').css({'height':st+'px'});
.wrapper{
background:#ccc;
width:100%;
height:100%;
display:flex;
flex-wrap:wrap;
flex-direction:row;}
.prodImage{
width:30%;
background:red;}
.prodDesc{
width:70%;
background:green;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="wrapper">
<div class="prodImage squarethis"></div>
<div class="prodDesc sameheight"></div>
</div>
it will apply on your bootstrap. try to input this.
let me explain what happened:
$('.squarethis').css({'height':st+'px}); it will make your image always square, and it don't care what devices you using.
$('.sameheight').css({'height':st+'px'}); and this thing will make your next bootstrap col following the height of your previous col.
don't forget to input a class in your image wrapper and description wrapper
I'd suggest you to look at bootstrap v4 which comes with awesome features, like flexbox grid.
It does just what you need - example:
#foo{
background-color: aqua;
height: 300px;
}
#bar{
background-color: yellow;
}
<link href="https://cask.scotch.io/bootstrap-4.0-flex.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-sm-6" id="foo">foo</div>
<div class="col-sm-6" id="bar">bar</div>
</div>
</div>
JSFiddle
You can tune this cell (product description) using plain css. Just a little modify class .border-l-default:
.border-l-default {
border-left: 1px solid blue;
height: 100%;
position: absolute;
right: 0;
}
bootply
Try to change the text ellipsis like that, it is a bit rude because i didn't use bootstrap classes, but it works fine to me:
.text-ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 71px;
}
Try to set min-height in different mediaquery
.border-l-default {
border-left: 1px solid blue;
min-height: 135px;

:active and :focus on anchor is not working for IE and Mozilla

In the below HTML code I am trying to achieve color change on current active anchor means once any tab is clicked it should show color(#ffd96b) as its background, it is working fine for Chrome but not working for IE and Mozilla. Not getting why it is happening may be I have missed something, Any help is much appreciated.
.tileMargin {
margin: 5%;
}
.deviceName {
width: 60%;
float: left;
padding: 5px;
border-radius: 5px 0px 0px 5px;
border: 1px solid #ccc;
background-color: #f2f2f2;
font-size: 0.75em;
}
.deviceCount {
width: 40%;
float: left;
background-color: #f2f2f2;
border-radius: 5px;
border: 1px solid #ccc;
text-align: center;
margin-left: -3px;
}
.deviceCount >div {
width: 33.33%;
float: left;
border-left: 1px solid #ccc;
}
.deviceCount input,
button {
width: 100%;
float: left;
padding: 3px 0px;
background-color: #f2f2f2;
border: none;
text-align: center;
appearance: button;
border-radius: 5px;
}
.devicesSmall a:hover div,
.devicesSmall a:hover input,
.devicesSmall a:hover button,
.devicesSmall a:active div,
.devicesSmall a:active input,
.devicesSmall a:active button,
.devicesSmall a:focus div,
.devicesSmall a:focus input,
.devicesSmall a:focus button {
background-color: #ffd96b !important;
}
<!Doctype HTML>
<html lang="en">
<head>
<Title>asd sada asfa</Title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="tileMargin">
<div class="devicesSmall col-lg-3 col-md-3 col-sm-6 col-xs-6 ">
<a href="#">
<div class="deviceName"><span>Mobile</span>
</div>
<div class="deviceCount">
<div>
<button onclick="addProduct('mobile');">+</button>
</div>
<div>
<input id="mobile" type="text" value="1" disabled>
</div>
<div>
<button onclick="removeProduct('mobile');">-</button>
</div>
</div>
</a>
</div>
<div class="devicesSmall col-lg-3 col-md-3 col-sm-6 col-xs-6">
<a href="#">
<div class="deviceName"><span>Landline</span>
</div>
<div class="deviceCount">
<div>
<button onclick="addProduct('landline');">+</button>
</div>
<div>
<input id="landline" type="text" value="1" disabled>
</div>
<div>
<button onclick="removeProduct('landline');">-</button>
</div>
</div>
</a>
</div>
<div class="devicesSmall col-lg-3 col-md-3 col-sm-6 col-xs-6">
<a href="#">
<div class="deviceName"><span>Internet</span>
</div>
<div class="deviceCount">
<div>
<button onclick="addProduct('internet');">+</button>
</div>
<div>
<input id="internet" type="text" value="0" disabled>
</div>
<div>
<button onclick="removeProduct('internet');">-</button>
</div>
</div>
</a>
</div>
<div class="devicesSmall col-lg-3 col-md-3 col-sm-6 col-xs-6">
<a href="#">
<div class="deviceName"><span>IPTV</span>
</div>
<div class="deviceCount">
<div>
<button onclick="addProduct('Iptv');">+</button>
</div>
<div>
<input id="Iptv" type="text" value="1" disabled>
</div>
<div>
<button onclick="removeProduct('Iptv');">-</button>
</div>
</div>
</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</body>
</html>
It is not that it isnt working in FF or IE, :active is applied at the moment when you click the element and DOES NOT preserve it. The styling is removed once you release the click.
Also after you click the link Chrome keeps the focus on the link whereas FF and IE does not. That is why the :focus styling is removed after you click it.
To make a link active, add a class active in CSS and add/remove the classes according to which link was clicked using JS.
First of all, Thanks to you all for looking into this issue...
I have found the issue in my code that was creating problem and causing :active and :focus not work as expected. Actually I had placed the form element like input and button under anchor tag, which is not correct implementation according to w3c standards.
Now I have removed all the button and input from inside that "a" tag and its working fine now.

Center input horizontally in div

I know this has been answered 100 times, but none of the existing solutions seem to work for me.
I want to center an input field horizontally in a div. Why is horizontal centering such a pain?!?!? The parent div may change in size based on screen size, so margin percentages don't work.
HTML
<div class="select" id="avatar">
<h4>Please enter your name.</h4>
<!-- Object i want to center-->
<div class="input-group">
<input type="text" class="form-control text-center" id="playerName">
</div>
<h4>And Select Your Ship</h4>
<img class="avatars" id="ship1" src="images/spaceship1.png">
<img class="avatars" id="ship2" src="images/spaceship2.png">
<img class="avatars" id="ship3" src="images/spaceship3.png">
<img class="avatars" id="ship4" src="images/spaceship4.png">
<button class="btn" id="submitPlayer">Submit</button>
</div>
parents CSS
.select {
background-color: white;
z-index: 200;
padding: 0px 15px 0px 15px;
text-align: center;
font-family: 'Krona One', sans-serif;
border: medium dashed green;
margin-left: 25%;
margin-right: 25%;
}
I also want to center this one, and I assume it will be the same solution, but it has no parent, besides body.
<div class="input-group">
<input class="text-center" type="text" id="word">
</div>
Why not use Bootstrap's center-block class..
<div class="input-group center-block">
<input class="center-block" type="text" id="word">
</div>
http://www.bootply.com/sTboTk5CvU
inputs and button are like img, you can display them as block and use margin:auto; so they stand alone and in the middle without using 100% of the width/space avalaible :
.select {
background-color: white;
z-index: 200;
padding: 0px 15px 0px 15px;
text-align: center;
font-family: 'Krona One', sans-serif;
border: medium dashed green;
margin-left: 25%;
margin-right: 25%;
}
button.btn#submitPlayer {
display: block;
margin: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="select" id="avatar">
<h4>Please enter your name.</h4>
<!-- Object i want to center-->
<div class="input-group">
<input type="text" class="form-control text-center" id="playerName">
</div>
<h4>And Select Your Ship</h4>
<img class="avatars" id="ship1" src="images/spaceship1.png">
<img class="avatars" id="ship2" src="images/spaceship2.png">
<img class="avatars" id="ship3" src="images/spaceship3.png">
<img class="avatars" id="ship4" src="images/spaceship4.png">
<button class="btn" id="submitPlayer">Submit</button>
</div>
and you may do the same with input :
.input-group,
input#word.text-center{
display: block;
margin: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="input-group">
<input class="text-center" type="text" id="word">
</div>

Vertically align right divs if another div to the left causes them to stack

This page has questions on the left, and radio buttons for ranking/scale answers on the right. It's designed so that if the question text is too long too fit in the left pane it just keeps going and pushes the radio buttons down a line beneath the question text. I emphasized if because I want to keep it that way, so it only moves if the text is long, I don't want to set something fixed so that every question does the same thing.
The problem is, the N/A radio button doesn't adjust like the other radio buttons. Is there a way to force it to move down with the others? I've tried surrounding the two sections with a div with vertical align bottom but that didn't work. Maybe I am doing something wrong but whatever I've read with regards to vertically aligning inner divs doesn't seem to accomplish this. Is it possible to fix this?
https://jsfiddle.net/x5y49d0n/
.qg {
width: 700px; /* this is only to demonstrate a smaller screen */
padding-top: 10px;
margin-top: 0;
}
.qg-row {
margin-left: 10px;
margin-bottom: 10px;
overflow: auto;
}
.qg-head {
padding-top: 5px;
padding-bottom: 5px;
background-color: #fcfcfc;
}
[class*="qg-guide"] {
font-size: 11px;
min-height: 10px;
text-align: center;
float: left;
}
[class*="qg-right-section"] {
float: right;
width: 500px;
}
.qg-right-section-1 {
width: 60px;
}
.qg-right-section-5 {
width: 300px;
}
[class*="qg-guide-"] {
word-wrap: break-word;
}
.qg-guide-1 {
empty-cells: hide;
width: 100%;
min-width: 100%;
}
.qg-guide-5 {
/* replicate in mobile */
empty-cells: show;
width: 20%;
min-width: 20%;
}
.qg-guide-7 {
empty-cells: show;
width: 14.28%;
min-width: 14.28%;
}
.qg-label {
font-size: 13px;
float: left;
margin-bottom: 10px;
}
[class*="qg-input"] {
font-size: 11px;
width: 60px;
text-align: center;
float: left;
}
<div class="qg">
<div class="qg-table">
<div class="qg-row qg-head">
<div class="qg-guide-label"></div>
<div class="qg-guide qg-right-section-1">
<div class="qg-guide-1"> </div>
</div>
<div class="qg-guide qg-right-section-5">
<div class="qg-guide-7">High7</div>
<div class="qg-guide-7"></div>
<div class="qg-guide-7"></div>
<div class="qg-guide-7">Neutral4</div>
<div class="qg-guide-7"></div>
<div class="qg-guide-7"></div>
<div class="qg-guide-7">Low1</div>
</div>
</div>
<div class="qg-row">
<div class="qg-label">Far far away, behind the word mountains, far from the countries Vokalia and Consonantia.</div>
<div class="qg-guide qg-right-section-1">
<div class="qg-input-1">
<input type="radio" name="0LoMVa" value=""><br>
N/A<br>
</div>
</div>
<div class="qg-right-section-5">
<div class="qg-input-5"><input type="radio" name="0LoMVa" value="5"><br>5<br></div>
<div class="qg-input-5"><input type="radio" name="0LoMVa" value="4"><br>4<br></div>
<div class="qg-input-5"><input type="radio" name="0LoMVa" value="3"><br>3<br></div>
<div class="qg-input-5"><input type="radio" name="0LoMVa" value="2"><br>2<br></div>
<div class="qg-input-5"><input type="radio" name="0LoMVa" value="1"><br>1<br></div>
</div>
</div>
</div>
</div>
<div class="qg">
<div class="qg-table">
<div class="qg-row qg-head">
<div class="qg-guide-label"></div>
<div class="qg-guide qg-right-section-1">
<div class="qg-guide-1"> </div>
</div>
<div class="qg-guide qg-right-section-5">
<div class="qg-guide-5 qg-guide-item-0">High0</div>
<div class="qg-guide-5 qg-guide-item-1"></div>
<div class="qg-guide-5 qg-guide-item-2">Neutral2</div>
<div class="qg-guide-5 qg-guide-item-3"></div>
<div class="qg-guide-5 qg-guide-item-4">Low4</div>
</div>
</div>
<div class="qg-row">
<div class="qg-label">Far far away, behind the word mountains.</div>
<div class="qg-guide qg-right-section-1">
<div class="qg-input-1">
<input type="radio" name="W1MkXk" value=""><br>
N/A<br>
</div>
</div>
<div class="qg-right-section-5">
<div class="qg-input-5"><input type="radio" name="W1MkXk" value="5"><br>5<br></div>
<div class="qg-input-5"><input type="radio" name="W1MkXk" value="4"><br>4<br></div>
<div class="qg-input-5"><input type="radio" name="W1MkXk" value="3"><br>3<br></div>
<div class="qg-input-5"><input type="radio" name="W1MkXk" value="2"><br>2<br></div>
<div class="qg-input-5"><input type="radio" name="W1MkXk" value="1"><br>1<br></div>
</div>
</div>
</div>
</div>
This is what I want it to do:
Also, these questions are created programmatically using a template, so the divs used have to be the same, IOW I can't add a div (with an additional class) to the 1st question that fixes the issue without the 2nd question having the same div. This is the critical requirement which is making it difficult for me to find a solution. Can this be solved?
Is it possible to change DOM structure?? If yes then just try pushing
<div class="qg-guide qg-right-section-1"></div> inside
<div class="qg-guide qg-right-section-5">
code
<div class="qg-row qg-head">
<div class="qg-guide-label"></div>
<div class="qg-guide qg-right-section-5">
<div class="qg-guide-5 qg-guide-item-0">High0</div>
<div class="qg-guide-5 qg-guide-item-1"></div>
<div class="qg-guide-5 qg-guide-item-2">Neutral2</div>
<div class="qg-guide-5 qg-guide-item-3"></div>
<div class="qg-guide-5 qg-guide-item-4">Low4</div>
<div class="qg-guide qg-right-section-1">
<div class="qg-guide-1"> </div>
</div>
</div>
</div>
and change css
.qg-right-section-5 {
width: 360px;
}
.qg-right-section-1 {
width: 60px;
float: left;
}
You can achieve the effect you want by adding a clear-fix after the .qg-label class. I did this in the fiddle by manually inserting an empty <div> with the style clear:both;. You could instead use the clear-fix class of your favorite library or create you own such as:
(This is a classic clearfix example from this answer)
.clearfix:after {
content: " "; /* Older browser do not support empty content */
visibility: hidden;
display: block;
height: 0;
clear: both;
}
Another solution is to include all radio buttons in the same parent element, give it a fixed width, and add float:right; to it and the radio element children. This should be a simple fix. I showed this in comparison to your original fiddle here - fiddle.