Add icon to end of radio input div - html

I'm attempting to create a similar UI as below using radio inputs. Most of the UI was fairly easy to recreate, the only exception is adding the arrow (icon?) to the end of the label div. I've attempted to div an arrow in and force it to the center using margins, but it's obviously not a very good solution. What's the best way to add the arrow at the end of the label?
Here's the current code
<div id='results'>
<form>
<input type="radio" name="result" value="1" id='opt-1' checked>
<label for="opt-1"><h3>Option 1</h3>
<p>Short Description of Option 1</p></label><br>
<input type="radio" name="result" value="2" id='opt-2' checked>
<label for="opt-2"><h3>Option 2</h3>
<p>Short Description of Option 2</p></label><br>
<input type="radio" name="result" value="3" id='opt-3' checked>
<label for="opt-3"><h3>Option 3</h3>
<p>Short Description of Option 3</p></label><br>
</form>
</div>
JSFiddle
EDIT:
I'm aware the JSFiddle doesn't apply the background correctly. The code does operate fine on production.

I've created a wrapper of class .list for each radio item to bind the data.
<div id='results'>
<form>
<div class="list">
<span>
<input type="radio" name="result" value="1" id='opt-1' checked>
</span>
<span class="radio-content">
<span>
<label class="mb-1" for="opt-1"><h3>Option 1</h3>
<p class="d-inline">Short Description of Option 1</p></label><br>
</span>
<span class="arrow"><</span>
</span>
</div>
<div class="list">
<span>
<input type="radio" name="result" value="1" id='opt-1' checked>
</span>
<span class="radio-content">
<span>
<label class="mb-1" for="opt-1"><h3>Option2</h3>
<p class="d-inline">Short Description of Option 2</p></label><br>
</span>
<span class="arrow"><</span>
</span>
</div>
</form>
</div>
CSS code here
.list{
display: flex;
align-items:center;
}
.mb-1{
margin-bottom: 8px;
}
.radio-content{
width:100%;
display:flex;
align-items:center;
justify-content: space-between;
}

Instead of "<" you can use the appropriate icon with the appropriate spacing
label {
background-color: #16a085;
background: linear-gradient(to right, #16a085, #66a99c);
width: 80%;
padding-left: 15px;
padding-top: 10px;
margin-bottom: 3px;
}
form > label > h3 {
margin-bottom: 1px;
}
form > label > p {
margin-top: 1px;
}
form > label h3::after {
content: '\276E';
position: absolute;
right: 0;
padding-right: 20px;
}
input[type=radio] {
display: none;
}
<div id='results'>
<form>
<input type="radio" name="result" value="1" id='opt-1' checked>
<label for="opt-1">
<h3>Option 1</h3>
<p>Short Description of Option 1</p>
</label><br>
<input type="radio" name="result" value="2" id='opt-2' checked>
<label for="opt-2">
<h3>Option 2</h3>
<p>Short Description of Option 2</p>
</label><br>
<input type="radio" name="result" value="3" id='opt-3' checked>
<label for="opt-3">
<h3>Option 3</h3>
<p>Short Description of Option 3</p>
</label><br>
</form>
</div>

So flexbox is awesome for layouts like these. It performs well and has great browser support (http://caniuse.com/#search=flexbox). IE has some issues but should be able to work around.
ul {
list-style: none;
width: 400px;
border: 1px solid #ccc;
margin: 0;
padding: 0;
}
ul li {
display: flex;
flex-direction: row;
justify-content: space-between;
border-bottom: 1px solid #ccc;
}
ul li:last-child {
border-bottom: none;
}
.title {
flex-grow: 1;
padding-top: 4px;
}
.title h3 {
margin: 0;
}
.title p {
font-size: 9px;
color: #aaa;
margin: 1px 0 0 0;
}
.icon {
padding-left: 10px;
width: 40px;
line-height: 50px;
display: inline-block;
}
.toggle-switch {
line-height: 50px;
width: 50px;
display: inline-block;
text-align: center;
}
<ul>
<li>
<span class="icon">*</span>
<div class="title">
<h3>Stops</h3>
<p>Non stop, 1 stop, 2+ stops</p>
</div>
<span class="toggle-switch">^</span>
</li>
<li>
<span class="icon">*</span>
<div class="title">
<h3>Duration</h3>
<p>Any</p>
</div>
<span class="toggle-switch">^</span>
</li>
</ul>

Related

Problem placing a customized select-box next to a searchbar in html

I have created both a select-box and a searchbar in html. Now I want to place both elements next to each other. I thought this would be possible by placing both elements into another div-container with display set to inline. But this doesn't really solve the issue.
.select-search-container {
display: inline;
}
.select-box {
display: flex;
flex-direction: column;
width: 400px;
}
.search-bar {
max-width: 400px;
border: none;
position: relative;
box-sizing: border-box;
left: calc(98% - 400px);
top: 20px;
}
#searchBarInput {
background: transparent;
padding: 12px 24px;
border-radius: 8px;
border: 2px solid black;
width: 100%;
box-sizing: border-box;
}
.search-bar__icon {
position: absolute;
height: 100%;
left: 90%;
top: 25%;
}
<div class="select-search-container">
<div class="select-box">
<div class="options-container">
<div class="option">
<input type="radio" class="radio" name="category" id="apples">
<label for="apples">apples</label>
</div>
<div class="option">
<input type="radio" class="radio" name="category" id="bananas">
<label for="bananas">bananas</label>
</div>
<div class="option">
<input type="radio" class="radio" name="category" id="lemons">
<label for="lemons">lemons</label>
</div>
</div>
<div class="selected">
Pick a fruit
</div>
</div>
<div class="search-bar" id="searchBar">
<input type="text" placeholder="Search Fruit" id="searchBarInput">
<i class="material-icons search-bar__icon">search</i>
</div>
</div>
As you can see, I have created the select-box using radio-buttons. I like the styling of this better than a normal select-box. Basically, I am showing the selected-div all the time and upon clicking on this div, I show the options-container. The display of the select-box is set to flex, with flex-direction column, as I want the options-container to be placed below the selected-div:
I am trying to place the searchbar next to the select-box. For this purpose I am also playing around with the left-, top- etc. specifiers. It doesn't really work though. When changing the display-type of the wrapper from inline to inline-flex, it kind of works, but the size of my searchbar shrinks and the icon isn't placed where I want it to be. I know this is a very specific question. I am very surprised that it doesn't work though and would really appreciate an explanation.
.select-search-container {
display: flex;
justify-content: space-between;
}
.select-box {
}
.search-bar {
max-width: 400px;
border: none;
position: relative;
box-sizing: border-box;
top: 20px;
}
#searchBarInput {
background: transparent;
padding: 12px 24px;
border-radius: 8px;
border: 2px solid black;
width: 100%;
box-sizing: border-box;
}
.search-bar__icon {
position: absolute;
height: 100%;
left: 90%;
top: 25%;
}
<div class="select-search-container">
<div class="select-box">
<div class="options-container">
<div class="option">
<input type="radio" class="radio" name="category" id="apples">
<label for="apples">apples</label>
</div>
<div class="option">
<input type="radio" class="radio" name="category" id="bananas">
<label for="bananas">bananas</label>
</div>
<div class="option">
<input type="radio" class="radio" name="category" id="lemons">
<label for="lemons">lemons</label>
</div>
</div>
<div class="selected">
Pick a fruit
</div>
</div>
<div class="search-bar" id="searchBar">
<input type="text" placeholder="Search Fruit" id="searchBarInput">
<i class="material-icons search-bar__icon">search</i>
</div>
</div>

Can't get text box on same line as checkbox

I have a form with a checkbox section. The last option is a text field for a custom entry, but I can't get the field onto the same line as the checkbox.
Picture for reference
HTML (I included the option before it as well for reference):
<li>
<label class="container">Legal
<input id="legal" name="legal" type="checkbox" value="1">
<span class="checkmark" class="square"></span>
</label>
</li>
<li>
<label class="container">
<input id="other" name="other" type="checkbox" value="1">
<span class="checkmark" class="square"></span>
</label>
<input id="otherText" maxlength="40" name="otherText" size="10" type="text" placeholder="Other...">
<span class="bar" style="width: 150px;"></span>
</li>
CSS:
#otherText{
font-size:.9em;
width: 150px;
display:block;
border:none;
color: #fff;
background-color: transparent;
border-bottom:1px solid #757575;
}
#otherText:focus { outline:none; }
<li>
<input id="legal" name="legal" type="checkbox" value="1">
<label class="container">Legal
<span class="checkmark" class="square"></span>
</label>
</li>
<li>
<label class="container">
<input id="other" name="other" type="checkbox" value="1">
<span class="checkmark" class="square"></span>
</label>
<input id="otherText" maxlength="40" name="otherText" size="10" type="text" placeholder="Other...">
<span class="bar" style="width: 150px;"></span>
</li>
CSS -
li {
display: flex;
}
Does this help?
Try display:inline, rather than display:block for your #otherText input. Check out this page for info about display options.
To me it looks as if inline-block will make a difference, and so did removing your color:#fff line:
#otherText{
font-size:.9em;
width: 150px;
display:inline-block;
border:none;
background-color: transparent;
border-bottom:1px solid #757575;
}
#otherText:focus { outline:none; }
<ul>
<li>
<label class="container">Legal
<input id="legal" name="legal" type="checkbox" value="1">
<!--span class="checkmark" class="square"></span-->
</label>
</li>
<li>
<label class="container">
<input id="other" name="other" type="checkbox" value="1">
<!--span class="checkmark" class="square"></span-->
</label>
<input id="otherText" maxlength="40" name="otherText" size="10" type="text" placeholder="Other...">
<span class="bar" style="width: 150px;"></span>
</li>
</ul>
As I did not see any merrit in your <span class="checkmark"> I commented them out out .
The problem was with the "container" class. It was set to display: block.
To solve, I removed the "container" class from the "other" option, and assigned it a unique id with all of the same styling except for display: block.
OP eventually found the solution on their own, but I would like to add something for future reference. I often in time see Flexbox being overlooked.
Flexbox is a great tool for exactly these kind of problems, which rely on grid. I would encourage everyone to read up on Flexbox, especially these properties:
flex-direction
flex-wrap
flex-grow
flex-shrink
flex-basis
justify-content
order
If you master these 7 properties, then grid troubles will be something of the past.
Pair it with max-width properties, padding, margin and what else you'd need to make the grid fit your design.
Often at times, CSS frameworks, such as Bootstrap, can be quite overkill if the project is of a small nature. CSS frameworks should only be justified if you can utilize multiple aspects of it over a larger project. Using Bootstrap for grid alone is not ideal. With that said, Bootstrap does offer a very powerful grid layout with the use of the classes row and col. It's worth reading up on.
Example of using flex with the current problem at hand:
HTML:
<div class="row container">
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="1" />
<span class="cb-text">Dev Team</span>
</div>
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="2" />
<span class="cb-text">Product Manager</span>
</div>
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="3" />
<span class="cb-text">Security / SecOps</span>
</div>
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="4" />
<span class="cb-text">DevOps / CI/CD</span>
</div>
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="5" />
<span class="cb-text">Legal</span>
</div>
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="6" />
<input type="text" class="cb-text other-text" placeholder="Other..." />
</div>
</div>
CSS:
.row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
flex: 0 0 100%;
max-width: 100%;
}
.container {
width: 650px;
height: 180px;
background-color: #4F4F4F;
padding: 15px;
justify-content: space-between;
margin-left: auto;
margin-right: auto;
font-size: 25px;
color: #FFFFFF;
}
.cb-container {
flex: 0 0 45%;
max-width: 45%;
padding-left: 15px;
padding-right: 15px;
justify-content: flex-start;
align-items: center;
gap: 8px;
}
.cb-element {
display: flex;
flex-direction: column;
flex: 0 0 25px;
max-width: 25px;
height: 25px;
}
input.other-text {
display: flex;
flex-direction: column;
flex: 0 0 65%;
max-width: 65%;
color: #FFFFFF;
font-size: 25px;
border-top: none;
border-left: none;
border-right: none;
border-bottom: 3px solid #B3B3B3;
background-color: transparent;
outline: none;
}
Snippet Example:
.row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
flex: 0 0 100%;
max-width: 100%;
}
.container {
width: 650px;
height: 180px;
background-color: #4F4F4F;
padding: 15px;
justify-content: space-between;
margin-left: auto;
margin-right: auto;
font-size: 25px;
color: #FFFFFF;
}
.cb-container {
flex: 0 0 45%;
max-width: 45%;
padding-left: 15px;
padding-right: 15px;
justify-content: flex-start;
align-items: center;
gap: 8px;
}
.cb-element {
display: flex;
flex-direction: column;
flex: 0 0 25px;
max-width: 25px;
height: 25px;
}
input.other-text {
display: flex;
flex-direction: column;
flex: 0 0 65%;
max-width: 65%;
color: #FFFFFF;
font-size: 25px;
border-top: none;
border-left: none;
border-right: none;
border-bottom: 3px solid #B3B3B3;
background-color: transparent;
outline: none;
}
<div class="row container">
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="1" />
<span class="cb-text">Dev Team</span>
</div>
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="2" />
<span class="cb-text">Product Manager</span>
</div>
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="3" />
<span class="cb-text">Security / SecOps</span>
</div>
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="4" />
<span class="cb-text">DevOps / CI/CD</span>
</div>
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="5" />
<span class="cb-text">Legal</span>
</div>
<div class="row cb-container">
<input type="checkbox" class="cb-element" value="6" />
<input type="text" class="cb-text other-text" placeholder="Other..." />
</div>
</div>
Codepen example here.
Useful links:
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
https://getbootstrap.com/docs/4.0/layout/grid/

HTML/CSS: Center Align Tabs

Problem: the html/css below displays the tabs fine but I would like to align them to the center. I have tried various ways but they still align to the left. How can I align the three tabs to the center and keep them inline-block? Any help is greatly appreciated, thank you.
I also attached a picture for reference.
main {
min-width: 320px;
max-width: 1000px;
padding: 50px;
margin: 0 auto;
background: #fff;
}
section {
display: none;
padding: 20px 0 0;
border-top: 1px solid #ddd;
}
.tabs {
display: none;
width: 100%;
margin: 0 auto;
}
label {
display: inline-block;
margin: 0 auto;
padding: 15px 25px;
text-align: center;
color: #bbb;
}
label[for*='1']:before {
content: ;
}
label[for*='2']:before {
content: ;
}
label[for*='3']:before {
content: ;
}
label:hover {
color: #888;
cursor: pointer;
}
.tabs:checked+label {
color: #555;
border-bottom: 2px solid orange;
}
#tab1:checked~#content1,
#tab2:checked~#content2,
#tab3:checked~#content3 {
display: block;
}
<main>
<input class="tabs" id="tab1" type="radio" name="tabs" checked>
<label for="tab1">Tab 1</label>
<input class="tabs" id="tab2" type="radio" name="tabs">
<label for="tab2">Tab 2</label>
<input class="tabs" id="tab3" type="radio" name="tabs">
<label for="tab3">Tab 3</label>
<section id="content1">
<img src="/images/autocode.jpeg" alt="Doctor Icon" class="key-modules-
innter-image" height="180" width="auto">
<h1 class="key-modules-inner-div-header">Tab 2</h1>
<p class="key-modules-inner-div-paragraph">random text will go here
</p>
<a href="/align-providers">
<button type="button" name="button" class="learn-button">Learn
more</button>
</a>
</section>
<section id="content2">
<img src="/images/autocode.jpeg" alt="Doctor Icon" class="key-modules-
innter-image" height="180" width="auto">
<h1 class="key-modules-inner-div-header">Tab 3</h1>
<p class="key-modules-inner-div-paragraph">random text will go here
</p>
<a href="/align-providers">
<button type="button" name="button" class="learn-button">Learn
more</button>
</a>
</section>
<section id="content3">
<img src="/images/autocode.jpeg" alt="Doctor Icon" class="key-modules-
innter-image" height="180" width="auto">
<h1 class="key-modules-inner-div-header">Tab 3</h1>
<p class="key-modules-inner-div-paragraph">random text will go here
</p>
<a href="/align-providers">
<button type="button" name="button" class="learn-button">Learn
more</button>
</a>
</section>
</main>
Here is my take at it using flexbox.
I added some holders and some css code
main {
min-width: 320px;
max-width: 1000px;
padding: 50px;
margin: 0 auto;
background: #fff;
}
section {
display: none;
padding: 20px 0 0;
border-top: 1px solid #ddd;
}
.tabs {
display: none;
margin: 0 auto;
}
label {
padding: 15px 25px;
text-align: center;
color: #bbb;
display: flex;
border: 1px solid blue;
align-self: center;
}
label[for*='1']:before {
content: ;
}
label[for*='2']:before {
content: ;
}
label[for*='3']:before {
content: ;
}
label:hover {
color: #888;
cursor: pointer;
}
.tabs-holder {
display: flex;
align-items: center;
flex-direction: column;
border: 1px solid red;
}
.tabs-grouper {
display: flex;
flex-direction: row;
border: 1px solid green;
}
<div class="tabs-holder">
<div class="tabs-grouper">
<input class="tabs" id="tab1" type="radio" name="tabs" checked>
<label for="tab1">Tab 1</label>
<input class="tabs" id="tab2" type="radio" name="tabs">
<label for="tab2">Tab 2</label>
<input class="tabs" id="tab3" type="radio" name="tabs">
<label for="tab3">Tab 3</label>
</div>
</div>
Simply add text-align: center to main, and then reset it all on section using text-align:left.
It will affect inline-block elements, but not your section being block, though as descendants might inherit it, the reset will take care of that.
Stack snippet
main {
min-width: 320px;
max-width: 1000px;
padding: 50px;
margin: 0 auto;
background: #fff;
text-align: center; /* added */
}
section {
display: none;
padding: 20px 0 0;
border-top: 1px solid #ddd;
text-align: left; /* added */
}
.tabs {
display: none;
width: 100%;
margin: 0 auto;
}
label {
display: inline-block;
margin: 0 auto;
padding: 15px 25px;
text-align: center;
color: #bbb;
}
label[for*='1']:before {
content: ;
}
label[for*='2']:before {
content: ;
}
label[for*='3']:before {
content: ;
}
label:hover {
color: #888;
cursor: pointer;
}
.tabs:checked+label {
color: #555;
border-bottom: 2px solid orange;
}
#tab1:checked~#content1,
#tab2:checked~#content2,
#tab3:checked~#content3 {
display: block;
}
<main>
<input class="tabs" id="tab1" type="radio" name="tabs" checked>
<label for="tab1">Tab 1</label>
<input class="tabs" id="tab2" type="radio" name="tabs">
<label for="tab2">Tab 2</label>
<input class="tabs" id="tab3" type="radio" name="tabs">
<label for="tab3">Tab 3</label>
<section id="content1">
<img src="/images/autocode.jpeg" alt="Doctor Icon" class="key-modules-
innter-image" height="180" width="auto">
<h1 class="key-modules-inner-div-header">Tab 2</h1>
<p class="key-modules-inner-div-paragraph">random text will go here
</p>
<a href="/align-providers">
<button type="button" name="button" class="learn-button">Learn
more</button>
</a>
</section>
<section id="content2">
<img src="/images/autocode.jpeg" alt="Doctor Icon" class="key-modules-
innter-image" height="180" width="auto">
<h1 class="key-modules-inner-div-header">Tab 3</h1>
<p class="key-modules-inner-div-paragraph">random text will go here
</p>
<a href="/align-providers">
<button type="button" name="button" class="learn-button">Learn
more</button>
</a>
</section>
<section id="content3">
<img src="/images/autocode.jpeg" alt="Doctor Icon" class="key-modules-
innter-image" height="180" width="auto">
<h1 class="key-modules-inner-div-header">Tab 3</h1>
<p class="key-modules-inner-div-paragraph">random text will go here
</p>
<a href="/align-providers">
<button type="button" name="button" class="learn-button">Learn
more</button>
</a>
</section>
</main>
You could wrap the tabs in a div and then set the wrapper css to margin:auto and width:20% or whatever keeps them inline.
I use the always good cheat, center tags!
<center>
<input class="tabs" id="tab1" type="radio" name="tabs" checked>
<label for="tab1">Tab 1</label>
<input class="tabs" id="tab2" type="radio" name="tabs">
<label for="tab2">Tab 2</label>
<input class="tabs" id="tab3" type="radio" name="tabs">
<label for="tab3">Tab 3</label>
</center>

How can I make interior <div> boxes with form inputs display in alignment?

I'm trying to get two interior div boxes with a header and form inputs to display side by side, like
this. I can do this with empty boxes, but when I add the form inputs box2 becomes offset as can be seen here:https://jsfiddle.net/4qux053b/
I discovered that if I add three line breaks after the radio buttons in box2 they come back into alignment, but this seems like a clumsy way of fixing the problem. Here's my code:
HTML
<div id="outer">
<div id="content">
<form name="orderForm" action="handler.php" method="post">
<div class="interior">
<h4>interior box1 heading</h4>
<label><input id="cb1" type="checkbox" name="checkboxes" value="cb1" />checkbox1</label><br />
<label><input id="cb2" type="checkbox" name="checkboxes" value="cb2" />checkbox2</label><br />
<label><input id="cb3" type="checkbox" name="checkboxes" value="cb3" />checkbox3</label><br />
<label><input id="cb4" type="checkbox" name="checkboxes" value="cb4" />checkbox4</label><br />
<label><input id="cb5" type="checkbox" name="checkboxes" value="cb5" />checkbox5</label><br />
<label><input id="cb6" type="checkbox" name="checkboxes" value="cb6" />checkbox6</label><br />
</div>
<div class="interior">
<h4>interior box2 heading</h4>
<label><input id="radio1" type="radio" name="radios" value="radio1" checked />radio1</label><br />
<label><input id="radio2" type="radio" name="radios" value="radio2" />radio2</label><br />
<label><input id="radio3" type="radio" name="radios" value="radio3" />radio3</label>
</div>
</form>
</div>
CSS
body {
font-family: sans-serif;
font-size: medium;
}
h4 {
margin: 0px;
}
#outer {
width: 100%;
max-width: 1000px;
text-align: center;
padding: 20px;
border: 1px solid black;
}
#content {
width: 90%;
padding: 5%;
border: 1px solid black;
}
.interior {
display: inline-block;
width: 24%;
max-width: 300px;
min-height: 200px;
padding: 2%;
border: 1px solid black;
}
Just add vertical-align:top to your interior class
.interior {
display: inline-block;
width: 24%;
max-width: 300px;
min-height: 200px;
padding: 2%;
border: 1px solid black;
vertical-align:top;
}
https://jsfiddle.net/4qux053b/1/

How to make my text next to checkbox not under it?

.selected_area {
background-color: #c8c8c8;
padding-top:5px;
height: 330px;
border-radius: 5px;
width:233px;
}
<div class="selected_area">
<label>
<input type="checkbox" value="scooter" id=""><div class="label-text fa-lg"><span>ScooterScooterScooterScooterScooter ScooterScooterScooter cooterScooterScooterScooter ScooterScooterScooter</span></div>
</label>
<label>
<input type="checkbox" value="motorcycle" id=""><div class="label-text fa-lg"><span>Motorcycle</span></div>
</label>
<label>
<input type="checkbox" value="downtown 250 en" id=""><div class="label-text fa-lg"><span>DOWNTOWN 250(EN)DOWNTOWN 250(EN)DOWNTOWN 250(EN) DOWNTOWN 250(EN)DOWNTOWN 250(EN)</span></div>
</label>
</div>
How to make my text next to checkbox not under it?
For this you've to write CSS like:
input[type="checkbox"] {
display: inline-block;
width: 15px;
vertical-align: top;
}
.label-text {
display: inline-block;
width: 200px;
word-break: break-all;
}
Also for side-by-side alignment you should use <span> instead of block elements like <div>.
I've created JSFiddle, please have a look.
try this
<div class="selected_area">
<label>
<input type="checkbox" value="scooter" id="">
<span class="label-text fa-lg">
<span>ScooterScooterScooterScooterScooter ScooterScooterScooter cooterScooterScooterScooter ScooterScooterScooter</span>
</span>
<br>
</label>
<label>
<input type="checkbox" value="motorcycle" id="">
Motorcycle
<br>
</label>
<label>
<input type="checkbox" value="downtown 250 en" id="">
DOWNTOWN 250(EN)DOWNTOWN 250(EN)DOWNTOWN 250(EN) DOWNTOWN 250(EN)DOWNTOWN 250(EN)
</label>
</div>
maybe so?
* {
padding: 0;
margin: 0;
}
.selected_area {
background-color: #c8c8c8;
padding:10px;
height: 330px;
border-radius: 5px;
width:233px;
margin: 20px;
}
.selected_area label {
position: relative;
margin: 10px 0;
display: block;
}
.selected_area .label-text {
position: relative;
padding-left: 24px;
}
.selected_area input {
position: absolute;
top: 2px;
left: 0;
}
<div class="selected_area">
<label>
<input type="checkbox" value="scooter" id="">
<div class="label-text fa-lg"><span>ScooterScooterScooterScooter ScooterScooterScooter cooterScooterScooterScooter ScooterScooterScooter</span>
</div>
</label>
<label>
<input type="checkbox" value="motorcycle" id="">
<div class="label-text fa-lg"><span>Motorcycle</span>
</div>
</label>
<label>
<input type="checkbox" value="downtown 250 en" id="">
<div class="label-text fa-lg"><span>DOWNTOWN 250(EN)DOWNTOWN 250(EN)DOWNTOWN 250(EN) DOWNTOWN 250(EN)DOWNTOWN 250(EN)</span>
</div>
</label>
</div>
.label-text.fa-lg {
display: inline-block;
}
check this link for more help on display property
https://css-tricks.com/almanac/properties/d/display/