JSFiddle - React, Tailwind, and code Playground
by Rozina Szogyenyi
HTML
<div class="my-element--container me-container--half">
<div class="my-element--element">
<div class="my-element--content content--quality">
<div class="my-element--item wide type-definition--select">
Select type
</div>
<div class="my-element--item narrow">
<label>
<input type="radio" name="type1" />
Full
</label>
</div>
<div class="my-element--item narrow">
<label>
<input type="radio" name="type2" />
Minimal
</label>
</div>
</div>
</div>
<div class="my-element--element">
<div class="my-element--content content--pace">
<div class="my-element--item wide type-definition--dropdown">
Select color
</div>
<div class="my-element--item narrow">
<label>
<input type="radio" name="color1" />
Red
</label>
</div>
<div class="my-element--item narrow last">
<label>
<input type="radio" name="color2" />
Blue
</label>
</div>
</div>
</div>
</div>
CSS
.my-element--container {
font: 13px Helvetica, sans-serif;
width: 310px;
background: #e5e9ed;
padding: 10px 10px 5px 10px;
}
.my-element--element {
background: #f1f3f5;
margin-bottom: 5px;
}
.my-element--content {
padding: 5px;
}
.my-element--item {
display: inline-block;
margin: 0 5px 0 0;
}
.my-element--element .content--pace {
margin-top: -5px;
}
.my-element--item.wide {
font-weight: bold;
width: 100px;
}
.my-element--item.narrow {
width: 70px;
}
.my-element--item label {
cursor: pointer;
}
.not-my-element--item .type-definition--select {
float: left;
}
.not-my-element--item .type-definition--dropdown {
float: left;
}
.not-my-element--item .type-definition--select:after,
.not-my-element--item .type-definition--dropdown:after {
content: '';
display: table;
}
.my-element--content .egg .my-element--item.narrow {
height: 10px;
}
JavaScript
/*
TASK 1: make 5px gap between the two elements
TASK 2: make sure that from each radio group only one of them can be selected
*/