I wish to move my radiobuttons under each of the selections. Radiobutton "test1" under the first selection and radiobutton "test2" under the second selection. That is, the radiobuttons are below the selection, but next to each other.
How do I do that? I do not wish to use tables or br. I would like to use CSS; how should I style my CSS?
<form name="test">
<label style="float:left;">test</label>
<input style="display:block" />
<label style="float:left;">test</label>
<input style="display:block" />
<label style="float:left;">test</label>
<select>
<option>1</option>
<option>2</option>
</select>
<select>
<option>a</option>
<option>b</option>
</select>
<input type="radio" name="test" value="test1">
<input type="radio" name="test" value="test2">
</form>
If I add more than one radio box:
I tried using +
(adjacent sibling selector) in CSS, but I think it is because the position is absolute. So the next "children" won't align horizontally. I think this is the easiest/"neat" way of doing it.
So I tried to position it relatively (the first radio box) and float:left
. But it positions itself too high.
Pure CSS input & radio-button. HTML and CSS just very simple radio buttons. A Fancy Checkbox/Radio buttons with small transition, enjoy it! 4 different ways to easily customize radio buttons. CSS only animated switch build with radio buttons. Material radio button with HTML, CSS and JavaScript. Radio buttons that are styled as actual buttons.
CSS Radio-button by 147th are CSS radio buttons. They stand out due to their different styling. As background, the developer used a card table design to place the buttons on. The functioning of the buttons is very simple. The site visitor can select only one button at a time.
Slider Revolution makes it possible for you to have a rush of clients coming to you for trendy website designs. CSS Radio-button by 147th are CSS radio buttons. They stand out due to their different styling. As background, the developer used a card table design to place the buttons on. The functioning of the buttons is very simple.
We have defined radio buttons as list items by using ul and li tags. These are specified in the parent element called container and contains respective CSS styles for the radio buttons.
Here is each radio button underneath each select element using only CSS without changing your HTML.
form {
display: block;
position: relative;
padding-bottom: 30px;
}
input[type="radio"] {
display: inline-block;
position: absolute;
bottom: 0;
left: 30px;
}
input[type="radio"]:last-child {
left: 70px;
}
JSFiddle Demo: https://jsfiddle.net/3w16q179/1/
More than 2 radio buttons:
JSFiddle Demo: https://jsfiddle.net/3w16q179/6/
This will align the radio buttons below the select inputs, regardless of width of their widths.
input[type="radio"] {
display: block;
}
<form name="test">
<label style="float:left;">test</label>
<input style="display:block" />
<label style="float:left;">test</label>
<input style="display:block" />
<label style="float:left;">test</label>
<div style="float:left;">
<select>
<option>1</option>
<option>2</option>
</select>
<input type="radio">
</div>
<div style="float:left;">
<select>
<option>2</option>
<option>3</option>
</select>
<input type="radio">
</div>
</form>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With