I have 2 cards with a class card that are displayed inside a card-stack. There can be N number of cards like this.
<div class="card-stack">
<div class="clear"><button name="clear" value="Clear all" onclick="removeAllCards(this)">Clear All</button></div>
<div class="card" style="--y:1" onclick="remove(this)">
<div class="card-header">
<div class="card-avatar">
<img src="https://static.thenounproject.com/png/363633-200.png">
</div>
<div class="card-title">Announcement 1</div>
</div>
<div class="card-body">
This is announcement 1.
</div>
</div>
<div class="card" style="--y:2" onclick="remove(this)">
<div class="card-header">
<div class="card-avatar">
<img src="https://static.thenounproject.com/png/363633-200.png">
</div>
<div class="card-title">Announcement 1</div>
</div>
<div class="card-body">
This is announcement 1.
</div>
</div>
</div>
When a user hovers on card-stack I apply some CSS to each card
.card-stack:hover .card{
transform: translateY(calc((var(--y) * -105% + 200px)));
box-shadow: none;
}
I would like to apply the HOVER css only if there are more than 1 elements with the class card. How do I do that using CSS?
CodePen for the below snippet
function remove(element) {
element.remove();
}
function removeAllCards(element) {
element.remove();
document.querySelectorAll(".card").forEach(el => el.remove());
}
body {
background-color: #e8eaed;
}
.card {
width: 300px;
min-height: 150px;
background-color: white;
position: fixed;
top: 75vh;
right: 100px;
transform: translate(-50%, -50%);
display: grid;
border-radius: 5px;
font-family: sans-serif;
font-size: 14px;
color: #00000080;
box-shadow: 0 5px 15px 0 #00000040, 0 5px 5px 0#00000020;
transition: transform 200ms;
padding:15px;
cursor:pointer;
}
.card {
transform: translateY(calc((var(--y) * 20px) - 50%)) scale(calc(1.0 + var(--y) * 0.05));
}
.card-avatar {
display:block;
}
.card-avatar img {
width:40px;
height:40px;
float:left;
}
.card-title {
font-size:16px;
display:inline-block;
margin-top:10px;
margin-left:10px;
}
.card-header {
height:30px;
display: inline-block;
}
.card-body {
margin-top:-30px;
}
.card-stack:hover .card{
transform: translateY(calc((var(--y) * -105% + 200px)));
box-shadow: none;
}
.card-stack:hover .clear {
visibility: visible;
transform: translateY(calc((var(--y) * -105% + 200px)));
position:absolute;
top:2vh;
right:40px;
}
.card-stack {
position:fixed;
width: 400px;
min-height: 100vh;
position: fixed;
right: 65px;
}
.clear {
visibility:hidden;
}
<div class="card-stack">
<div class="clear"><button name="clear" value="Clear all" onclick="removeAllCards(this)">Clear All</button></div>
<div class="card" style="--y:1" onclick="remove(this)">
<div class="card-header">
<div class="card-avatar">
<img src="https://static.thenounproject.com/png/363633-200.png">
</div>
<div class="card-title">Announcement 1</div>
</div>
<div class="card-body">
This is announcement 1.
</div>
</div>
<div class="card" style="--y:2" onclick="remove(this)">
<div class="card-header">
<div class="card-avatar">
<img src="https://static.thenounproject.com/png/363633-200.png">
</div>
<div class="card-title">Announcement 1</div>
</div>
<div class="card-body">
This is announcement 1.
</div>
</div>
</div>
One solution would be to target classes that are both first-child and last-child at the same time
.myClass {
color: tomato;
}
.myClass:first-child:last-child {
color: DarkSlateGrey;
}
<div>
<span class="myClass">I'm alone</span>
</div>
<div>
<span class="myClass">We are two</span>
<span class="myClass">We are two</span>
</div>
You can do what Creaforge says and override it for when there is only one .card element, except you'd need to specify the transform and box shadow twice, which means code duplication. And those transform and box shadow values are pretty long.
There are two much cleaner ways to do this:
With a selector. Normally I'd recommend .card-stack:hover .card:not(:nth-child(2):last-child), but level 4 :not() support is still a little incomplete so if you're worried about that you need to do it the old way which looks like this:
.card-stack:hover .card:not(:nth-child(2)), .card-stack:hover .card:not(:last-child) {
transform: translateY(calc((var(--y) * -105% + 200px)));
box-shadow: none;
}
Move the .clear element out of the .card-stack element. There doesn't appear to be a very good reason it needs to be in there. Then change the selector to
.card-stack:hover .card:not(:only-child) {
transform: translateY(calc((var(--y) * -105% + 200px)));
box-shadow: none;
}
(again, outside of level 4 :not() you can't do :not(:first-child:last-child) like Creaforge says, but at the very least CSS gives you :only-child to use)
If your trying to seperate them you can add id="Card1" and id="Card2" and in css just style the id's with #Card1 and #Card2, hope this helps :)
Maybe you can apply :nth-child(n+1) to your card class. It will only select every element after the first one.
See here for more information: https://css-tricks.com/useful-nth-child-recipies/#select-all-but-the-first-five
Maybe you can add a class using javascript instead? That is, renaming the css for hover and applying that class only if card-stack has more than two children. Then utilizing "onmouseover" prop.
<div class="card-stack" onmouseover="onHover(this)">
...
</div>
.card-stack-h:hover .card{
transform: translateY(calc((var(--y) * -105% + 200px)));
box-shadow: none;
}
.card-stack-h:hover .clear {
visibility: visible;
transform: translateY(calc((var(--y) * -105% + 200px)));
position:absolute;
top:2vh;
right:40px;
}
function onHover(stack) {
let cards = stack.querySelectorAll(".card")
if(cards.length > 1) stack.classList.add("card-stack-h")
else stack.classList.remove("card-stack-h");
}
Codepen
How can I (CSS-only) style an input with type="checkbox", and keep the existing label declared for that input element?
<p id="lorem-ipsum">
<label for="dolor-sit-amet">Dolor sit amet</label>
<input type="checkbox" id="dolor-sit-amet" name="dolor" />
</p>
I want to style the checkbox element so that it has a "flip switch" appearance and behaviour.
Keep the existing label
There are numerous articles (an example from 2012) that describe this kind of complete change to the appearance of a checkbox, but I haven't found one that lets the label (as already used in the above document) remain untouched.
For this reason, many of the answers in this similar StackOverflow question do not apply here.
In other words: I want to keep the label element as already written, and I want to have the checkbox styled like a flip switch with "on" and "off" inside it.
How can I do that without changing or styling the existing label element, and instead styling the input element?
if you can change the sequence in label and input, here is an idea.
you can change the colors and add animation as per your requirement.
label{
position:relative;
display:block;
width:200px;
}
label:before{
content:'off';
width:50px;
height:20px;
background:#eee;
border-radius:50px;
position:absolute;
right:0
}
label:after{
content:'';
width:18px;
height:18px;
background:#333;
border-radius:50px;
position:absolute;
right:1px;
top:1px;
}
input:checked + label:before{
content:'on';
text-indent: 25px;
}
input:checked + label:after{
right:29px;
top:1px;
}
<p id="lorem-ipsum">
<input type="checkbox" id="dolor-sit-amet" name="dolor" />
<label for="dolor-sit-amet">Dolor sit amet</label>
</p>
The :before and :after selectors can create some of the content. By adding another element (for example, a span) that can be styled to appear as the “slider” of the switch.
Then, the containing element – which can be the label itself! – can also have :before and :after selectors used to style the “socket” in which the slider moves.
input[type=checkbox].switch {
display: none;
}
label.switch.socket {
position: relative;
width: auto;
text-indent: 6.0ex;
}
span.switch.slider {
display: inline-block;
}
label.switch.socket span.switch.slider:before {
content: "off";
text-indent: 2.3ex;
width: 5.5ex;
height: 2.2ex;
color: White;
background: DimGray;
border-radius: 5.5ex;
position: absolute;
left: 0;
}
label.switch span.switch.slider:after {
content: "";
width: 2.0ex;
height: 2.0ex;
background: Gainsboro;
border-radius: 5.5ex;
position: absolute;
left: 0.1ex;
top: 0.1ex;
transition: 0.2s;
}
label.switch.socket input[type=checkbox]:checked + span.slider:before {
content: "on";
text-indent: 0.5ex;
color: Black;
background: DarkGray;
}
label.switch.socket input[type=checkbox]:checked + span.slider:after {
left: 3.4ex;
}
<p>
<label class="switch socket">
<input type="checkbox" class="switch" name="lorem" />
<span class="switch slider" />
Lorem ipsum
</label>
<label class="switch socket">
<input type="checkbox" class="switch" name="dolor" checked />
<span class="switch slider round" />
Dolor sit amet
</label>
</p>
(Thanks to #gosi123 and #aje for suggestions that came close enough to help me formulate this answer.)
I have an input box with a label. The label is inside the input box. I want the label to move above the input box when the input box is focused.
I think I need to use input:focus ~ label to focus the label when the input box is selected but I cannot get it to work.
html:
<div class="search-container">
<form [formGroup]="SearchForm" (ngSubmit)="getWeatherFromCity(SearchForm.value)" name="SearchForm">
<div class='city-input'>
<label for="searchCity">City </label>
<input class="form-input" formControlName="searchCity" id="searchCity">
</div>
<button class="button" title="Search">Search
</button>
</form>
</div>
css:
.search-container{
font-family: 'Roboto', sans-serif;
font-size: 20px;
margin: 20px;
.city-input{
position: relative;
display: inline;
input{
border-radius: 10px;
height: 2em;
width: 17.5em;
&:focus ~ label {
transform: translateY(-30px);
color: red
}
}
label{
transition: transform 0.5s;
position: absolute;
padding: 10px;
}
}
Please advise.
Cheers.
you can't select a previous element with just css afaik
you could use jQuery for this, kinda... demo
$( ".form-input" ).focus(function() {
$(".form-input").prev("label").addClass("the-class-to-handle-the-transition");
});
$( ".form-input" ).focusout(function() {
$(".form-input").prev("label").removeClass("the-class-to-handle-the-transition");
});
How can I use a div as radio button ?
I mean that :
you can select a div and then it is bordered blue
you can only select one of them
If you want a CSS Only solution, this is an excellent one :
.labl {
display : block;
width: 400px;
}
.labl > input{ /* HIDE RADIO */
visibility: hidden; /* Makes input not-clickable */
position: absolute; /* Remove input from document flow */
}
.labl > input + div{ /* DIV STYLES */
cursor:pointer;
border:2px solid transparent;
}
.labl > input:checked + div{ /* (RADIO CHECKED) DIV STYLES */
background-color: #ffd6bb;
border: 1px solid #ff6600;
}
<label class="labl">
<input type="radio" name="radioname" value="one_value" checked="checked"/>
<div>Small</div>
</label>
<label class="labl">
<input type="radio" name="radioname" value="another" />
<div>Small</div>
</label>
Inspired by this answer
Yes, you can use 'div' as radio button and will work as radio button groups. But for this you'll need Javascript. I've created a script for that using JQuery. Here is the source--
$('.radio-group .radio').click(function(){
$(this).parent().find('.radio').removeClass('selected');
$(this).addClass('selected');
var val = $(this).attr('data-value');
//alert(val);
$(this).parent().find('input').val(val);
});
.radio-group{
position: relative;
}
.radio{
display:inline-block;
width:15px;
height: 15px;
border-radius: 100%;
background-color:lightblue;
border: 2px solid lightblue;
cursor:pointer;
margin: 2px 0;
}
.radio.selected{
border-color: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h2>Select an option (You will get it's value displayed in the text input field!)</h2>
<form method="post" action="send.php">
<div class="radio-group">
<div class='radio' data-value="One"></div>1
<div class='radio' data-value="Two"></div>2
<div class='radio' data-value="Three"></div>3
<br/>
<input type="text" id="radio-value" name="radio-value" />
</div>
</form>
This is a simple solution.
HTML
<div class="option first">1</div>
<div class="option second">2</div>
<div class="option third">3</div>
<div class="option fourth">4</div>
CSS
.option
{
background-color:red;
margin: 10px auto;
}
.option.active
{
border:1px solid blue;
}
Jquery
$(document).ready(
function()
{
$(".option").click(
function(event)
{
$(this).addClass("active").siblings().removeClass("active");
}
);
});
link
Is there a way to control the size of the radio button in CSS ?
This css seems to do the trick:
input[type=radio] {
border: 0px;
width: 100%;
height: 2em;
}
Setting the border to 0 seems to allow the user to change the size of the button and have the browser render it in that size for eg. the above height: 2em will render the button at twice the line height. This also works for checkboxes (input[type=checkbox]). Some browsers render better than others.
From a windows box it works in IE8+, FF21+, Chrome29+.
Old question but now there is a simple solution, compatible with most browsers, which is to use CSS3. I tested in IE, Firefox and Chrome and it works.
input[type="radio"] {
-ms-transform: scale(1.5); /* IE 9 */
-webkit-transform: scale(1.5); /* Chrome, Safari, Opera */
transform: scale(1.5);
}
Change the value 1.5, in this case an increment of 50% in size, according to your needs. If the ratio is very high, it can blur the radio button. The next image shows a ratio of 1.5.
You can control radio button's size with css style:
style="height:35px; width:35px;"
This directly controls the radio button size.
<input type="radio" name="radio" value="value" style="height:35px; width:35px; vertical-align: middle;">
A solution which works quite well is described right here:
https://developer.mozilla.org/fr/docs/Web/HTML/Element/Input/radio
The idea is to use the appearance property, which when set to none allows to change the width and height of the radio button.
The radio buttons are not blurry, and you can add other effects like transitions and stuff.
Here's an example :
input {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border-radius: 50%;
width: 16px;
height: 16px;
border: 2px solid #999;
transition: 0.2s all linear;
margin-right: 5px;
position: relative;
top: 4px;
}
input:checked {
border: 6px solid black;
outline: unset !important /* I added this one for Edge (chromium) support */
}
The only drawback is that it is not supported yet on IE.
Here's a GIF below to give an idea of what can be achieved. The result will look nicer on an actual browser.
And the plunker : https://plnkr.co/plunk/1W3QXWPi7hdxZJuT
Not directly. In fact, form elements in general are either problematic or impossible to style using CSS alone. the best approach is to:
hide the radio button using javascript.
Use javascript to add/display HTML that can be styled how you like e.g.
Define css rules for a selected state, which is triggered by adding a class "selected" to yuor span.
Finally, write javascript to make the radio button's state react to clicks on the span, and, vice versa, to get the span to react to changes in the radio button's state (for when users use the keyboard to access the form). the second part of this can be tricky to get to work across all browsers. I use something like the following (which also uses jQuery. I avoid adding extra spans too by styling and applying the "selected" class directly to the input labels).
javascript
var labels = $("ul.radioButtons).delegate("input", "keyup", function () { //keyboard use
if (this.checked) {
select($(this).parent());
}
}).find("label").bind("click", function (event) { //mouse use
select($(this));
});
function select(el) {
labels.removeClass("selected");
el.addClass("selected");
}
html
<ul class="radioButtons">
<li>
<label for="employee1">
employee1
<input type="radio" id="employee1" name="employee" />
</label>
</li>
<li>
<label for="employee2">
employee1
<input type="radio" id="employee2" name="employee" />
</label>
</li>
</ul>
Resizing the default widget doesn’t work in all browsers, but you can make custom radio buttons with JavaScript. One of the ways is to create hidden radio buttons and then place your own images on your page. Clicking on these images changes the images (replaces the clicked image with an image with a radio button in a selected state and replaces the other images with radio buttons in an unselected state) and selects the new radio button.
Anyway, there is documentation on this subject. For example, read this: Styling Checkboxes and Radio Buttons with CSS and JavaScript.
Here's one approach. By default the radio buttons were about twice as large as labels.
(See CSS and HTML code at end of answer)
Safari: 10.0.3
Chrome: 56.0.2924.87
Firefox: 50.1.0
Internet Explorer: 9 (Fuzziness not IE's fault, hosted test on netrenderer.com)
CSS:
.sortOptions > label {
font-size: 8px;
}
.sortOptions > input[type=radio] {
width: 10px;
height: 10px;
}
HTML:
<div class="rightColumn">Answers
<span class="sortOptions">
<input type="radio" name="answerSortList" value="credate"/>
<label for="credate">Creation</label>
<input type="radio" name="answerSortList" value="lastact"/>
<label for="lastact">Activity</label>
<input type="radio" name="answerSortList" value="score"/>
<label for="score">Score</label>
<input type="radio" name="answerSortList" value="upvotes"/>
<label for="upvotes">Up votes</label>
<input type="radio" name="answerSortList" value="downvotes"/>
<label for="downvotes">Down Votes</label>
<input type="radio" name="answerSortList" value="accepted"/>
<label for="downvotes">Accepted</label>
</span>
</div>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
input[type="radio"] {
-ms-transform: scale(1.5); /* IE 9 */
-webkit-transform: scale(1.5); /* Chrome, Safari, Opera */
transform: scale(1.5);
}
</style>
</head>
<body>
<div class="container">
<h2>Form control: inline radio buttons</h2>
<p>The form below contains three inline radio buttons:</p>
<form>
<label class="radio-inline">
<input type="radio" name="optradio">Option 1
</label>
<label class="radio-inline">
<input type="radio" name="optradio">Option 2
</label>
<label class="radio-inline">
<input type="radio" name="optradio">Option 3
</label>
</form>
</div>
</body>
</html>
Well, I am from the future as compared to the posted year of this question, but I believe my answer will benefit all the new visitors:
So if you want to increase the size of the "radio" button with CSS you can simply do it by putting the following styling rules in CSS and it will help you,
input[radio] {
height: 20px;
width: 20px;
vertical-align: middle;
}
This works fine for me in all browsers:
(inline style for simplicity...)
<label style="font-size:16px;">
<input style="height:1em; width:1em;" type="radio">
<span>Button One</span>
</label>
The size of both the radio button and text will change with the label's font-size.
Directly you can not do this. [As per my knowledge].
You should use images to supplant the radio buttons. You can make them function in the same manner as the radio buttons inmost cases, and you can make them any size you want.
You can also use the transform property, with required value in scale:
input[type=radio]{transform:scale(2);}
(Vue3) HTML:
<h2>Group By</h2>
<div class="radioButtons">
<label><input type="radio" id="groupByDevice"
v-model="data.groupBy" value="device" />
<span>Device Location</span>
</label>
<label><input type="radio" id="groupByLocation"
v-model="data.groupBy" value="location" />
<span>Device Type</span></label>
</div>
</div>
SASS:
$vw-viewport: 2400px;
#function toVw($vw-viewport, $value) {
#return ($value / $vw-viewport) * 100vw;
}
label {
font-size: toVw($vw-viewport, 16px);
line-height: toVw($vw-viewport, 18px);
}
.radioButtons {
> label {
white-space: no-wrap;
display: inline-block;
height: toVw($vw-viewport, 22px);
margin: 0 toVw($vw-viewport, 10px) toVw($vw-viewport, 5px) 0;
> input[type=radio] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
display: inline-block;
border-radius: 50%;
width: toVw($vw-viewport, 18px);
height:toVw($vw-viewport, 18px);
border: toVw($vw-viewport,2px) solid #747474;
margin: 0;
position: relative;
top: toVw($vw-viewport, 2px);
background: white;
&::after {
content: '';
position: absolute;
top: 12.5%;
left: 12.5%;
right: 12.5%;
bottom: 12.5%;
width: auto;
height: auto;
background: rgb(80, 95, 226);
opacity: 0;
border-radius: 50%;
transition: 0.2s opacity linear;
}
&:checked {
&::after {
opacity: 1 !important;
background: rgb(80, 95, 226) !important;
}
}
}
&:hover {
cursor: pointer;
> input[type=radio]::after {
opacity: 1;
background: #cfd1e2;
}
}
> span {
display: inline-block;
position: relative;
top: toVw($vw-viewport, -1px);
padding-left: toVw($vw-viewport, 7px);
}
}
}
The result is like this. On hover, a gray dot appears as well. The labels will wrap horizontally when there is room, there was not enough room here so they stack. This scales with the page. If you don't need that, remove the SASS function and use the pixels directly. This is a case where !important is being used correctly IMHO, in this case to override hover when the radio is checked.
try this code... it may be the ans what you exactly looking for
body, html{
height: 100%;
background: #222222;
}
.container{
display: block;
position: relative;
margin: 40px auto;
height: auto;
width: 500px;
padding: 20px;
}
h2 {
color: #AAAAAA;
}
.container ul{
list-style: none;
margin: 0;
padding: 0;
overflow: auto;
}
ul li{
color: #AAAAAA;
display: block;
position: relative;
float: left;
width: 100%;
height: 100px;
border-bottom: 1px solid #333;
}
ul li input[type=radio]{
position: absolute;
visibility: hidden;
}
ul li label{
display: block;
position: relative;
font-weight: 300;
font-size: 1.35em;
padding: 25px 25px 25px 80px;
margin: 10px auto;
height: 30px;
z-index: 9;
cursor: pointer;
-webkit-transition: all 0.25s linear;
}
ul li:hover label{
color: #FFFFFF;
}
ul li .check{
display: block;
position: absolute;
border: 5px solid #AAAAAA;
border-radius: 100%;
height: 25px;
width: 25px;
top: 30px;
left: 20px;
z-index: 5;
transition: border .25s linear;
-webkit-transition: border .25s linear;
}
ul li:hover .check {
border: 5px solid #FFFFFF;
}
ul li .check::before {
display: block;
position: absolute;
content: '';
border-radius: 100%;
height: 15px;
width: 15px;
top: 5px;
left: 5px;
margin: auto;
transition: background 0.25s linear;
-webkit-transition: background 0.25s linear;
}
input[type=radio]:checked ~ .check {
border: 5px solid #0DFF92;
}
input[type=radio]:checked ~ .check::before{
background: #0DFF92;
}
<ul>
<li>
<input type="radio" id="f-option" name="selector">
<label for="f-option">Male</label>
<div class="check"></div>
</li>
<li>
<input type="radio" id="s-option" name="selector">
<label for="s-option">Female</label>
<div class="check"><div class="inside"></div></div>
</li>
<li>
<input type="radio" id="t-option" name="selector">
<label for="t-option">Transgender</label>
<div class="check"><div class="inside"></div></div>
</li>
</ul>
<html>
<head>
</head>
<body>
<style>
.redradio {border:5px black solid;border-radius:25px;width:25px;height:25px;background:red;float:left;}
.greenradio {border:5px black solid;border-radius:25px;width:29px;height:29px;background:green;float:left;}
.radiobuttons{float:left;clear:both;margin-bottom:10px;}
</style>
<script type="text/javascript">
<!--
function switchON(groupelement,groupvalue,buttonelement,buttonvalue) {
var groupelements = document.getElementById(groupelement);
var buttons = groupelements.getElementsByTagName("button");
for (i=0;i<buttons.length;i++) {
if (buttons[i].id.indexOf("_on") != -1) {
buttons[i].style.display="none";
} else {
buttons[i].style.display="block";
}
}
var buttonON = buttonelement + "_button_on";
var buttonOFF = buttonelement + "_button_off";
document.getElementById(buttonON).style.display="block";
document.getElementById(buttonOFF).style.display="none";
document.getElementById(groupvalue).value=buttonvalue;
}
// -->
</script>
<form>
<h1>farbige Radiobutton</h1>
<div id="button_group">
<input type="hidden" name="button_value" id="button_value" value=""/>
<span class="radiobuttons">
<button type="button" value="OFF1" name="button1_button_off" id="button1_button_off" onclick="switchON('button_group','button_value','button1',this.value)" class="redradio"></button>
<button type="button" value="ON1" name="button1_button_on" id="button1_button_on" style="display:none;" class="greenradio"></button>
<label for="button1_button_on"> Ich will eins</label>
</span><br/>
<span class="radiobuttons">
<button type="button" value="OFF2" name="button2_button_off" id="button2_button_off" onclick="switchON('button_group','button_value','button2',this.value)" class="redradio"></button>
<button type="button" value="ON2" name="button2_button_on" id="button2_button_on" style="display:none;" class="greenradio"></button>
<label for="button2_button_on"> Ich will zwei</label>
</span><br/>
<span class="radiobuttons">
<button type="button" value="OFF3" name="button3_button_off" id="button3_button_off" onclick="switchON('button_group','button_value','button3',this.value)" class="redradio"></button>
<button type="button" value="ON3" name="button3_button_on" id="button3_button_on" style="display:none;" class="greenradio"></button>
<label for="button3_button_on"> Ich will drei</label>
</span><br/>
<span class="radiobuttons">
<button type="button" value="OFF4" name="button4_button_off" id="button4_button_off" onclick="switchON('button_group','button_value','button4',this.value)" class="redradio"></button>
<button type="button" value="ON4" name="button4_button_on" id="button4_button_on" style="display:none;" class="greenradio"></button>
<label for="button4_button_on"> Ich will vier</label>
</span>
</div>
</form>
</body>
</html>