checkbox only show when the screen is zoomed out - css

I have been using a custom check box for my project. there are 5 checkboxes in a line. but in the standard view, it only shows 4 checkboxes. but when I zoomed out it will show the missing checkbox. how can I overcome this?
HTML:
<div className="checkbox-container-05">
<input id='CP5' name='3565' type='checkbox' onChange={(e)=>seatNohandleChecked(e)} className='pit-2' />
<label htmlFor='CP5' className='btn'>CP5</label>
<input id='CP6' name='3565' type='checkbox' onChange={(e)=>seatNohandleChecked(e)} className='pit-2' />
<label htmlFor='CP6' className='btn'>CP6</label>
<input id='CP7' name='3565' type='checkbox' onChange={(e)=>seatNohandleChecked(e)} className='pit-2' />
<label htmlFor='CP7' className='btn'>CP7</label>
<input id='CP8' name='3565' type='checkbox' onChange={(e)=>seatNohandleChecked(e)} className='pit-2' />
<label htmlFor='CP8' className='btn'>CP8</label>
<input id='CP9' name='3565' type='checkbox' onChange={(e)=>seatNohandleChecked(e)} className='pit-2' />
<label htmlFor='CP9' className='btn'>CP9</label>
<input id='CP10' name='3565' type='checkbox' onChange={(e)=>seatNohandleChecked(e)} className='pit-2' />
<label htmlFor='CP10' className='btn'>CP10</label>
</div>
CSS:
.checkbox-container-05 {
display: contents;
flex-direction: row;
}
.pit-2 {
cursor: pointer;
-webkit-appearance: none;
appearance: none;
background: url(../images/event_seats_plan/freddy/pit.png);
background-size: cover;
border-radius: 1px;
box-sizing: border-box;
position: relative;
box-sizing: content-box;
width: 60px;
height: 45px;
border-width: 0;
transition: all .3s linear;
text-align: center;
right: 640px;
bottom: 740px;
display: flex;
}
Zoomed out
Normal view

Related

How can I neatly line up the checkbox and radio box

I'm not sure how I'm suposed neatly line inputs in a row. I tried using flex and position: relative (for the label) but that didn't work for me. I'm trying to make it look like this for example for both my checkboxes and radios:
But this is what I got instead:
Please explain how I can find a solution to this problem.
https://codepen.io/Yisego45873/pen/WNEJPVx
#import url('https://fonts.googleapis.com/css2?family=Playfair+Display&family=Quicksand&display=swap');
* {
box-sizing: border-box;
text-align: center;
font-family: 'Playfair Display', serif;
font-family: 'Quicksand', sans-serif;
}
body {
background: linear-gradient(40deg, transparent 40%, rgb(41, 39, 39)), linear-gradient(-40deg, rgb(78, 75, 75) 20%, #81777d 90%);
}
header {
color: white;
}
div {
background-color: rgb(68, 65, 65);
padding: 35px;
opacity: 200%;
margin: 0 30px;
border: rgb(41, 39, 39) solid 3px;
border-radius: 3px;
margin-bottom: 20px;
}
form {
color: white;
}
#sect-1 label {
margin: 0 0 15px;
color: white;
}
#sect-1 input {
border: white;
width: 50%;
border-radius: 2px;
padding: 10px;
margin: 15px;
}
select {
border: white;
width: 50%;
color: #4d4a4a;
border-radius: 1px;
padding: 10px;
margin: 15px;
color: black;
}
span {
font-style: italic;
opacity: 80%;
}
select option {
color: black;
}
#range {
width: 50%;
}
input[type=checkbox] {
-ms-transform: scale(1.5);
/* IE */
-moz-transform: scale(1.5);
/* FF */
-webkit-transform: scale(1.5);
/* Safari and Chrome */
-o-transform: scale(1.5);
/* Opera */
transform: scale(1.5);
}
input[type=radio] {
/* IE */
-ms-transform: scale(1.4);
/* FF */
-moz-transform: scale(1.4);
/* Safari and Chrome */
-webkit-transform: scale(1.4);
/* Opera */
-o-transform: scale(1.4);
transform: scale(1.4);
position: absolute;
left: 300px;
}
textarea {
padding: 5px;
margin: auto;
/* IE */
-ms-transform: scale(1.4);
/* FF */
-moz-transform: scale(1.4);
/* Safari and Chrome */
-webkit-transform: scale(1.4);
/* Opera */
-o-transform: scale(1.4);
transform: scale(1.4);
color: black;
margin-bottom: 50px;
margin-top: 50px;
text-align: left;
}
label {
margin-top: 30px;
margin-bottom: 5px;
}
#sect-1 {
color: black;
}
input[type=submit] {
background-color: rgb(41, 39, 39);
border: rgb(41, 39, 39) 10px solid;
width: 50%;
margin-top: 10px;
border-radius: 5px;
}
input[type=submit]:hover {
background-color: rgb(110, 108, 108);
border: 10px solid rgb(110, 108, 108);
cursor: pointer;
}
#range-section {
margin-bottom: 15px;
}
#sect-2,
#sect-3 {
display: flex;
}
#sect-2,
#sect-3 label {
position: relative;
}
<header>
<h1 id="title">Art Course Survey Page</h1>
<p id="description">Any feedback would be appreciated.</p>
</header>
<div>
<form id="survey-form" action="#" method="post">
<section id="sect-1">
<label id="name-label" for="name">Name</label><br />
<input type="text" name="name" id="name" placeholder="Enter your name" required="required" /><br />
<label id="email-label" for="email">Email</label><br />
<input type="email" name="email" id="email" placeholder="Enter your email address" required="required" /><br />
<label id="number-label" for="number">Age <span>(optional)</span></label><br />
<input type="number" name="number" id="number" placeholder="Age" min="1" max="99" /><br />
<label id="gender" for="gender-drop">Gender <span>(optional)</span></label><br />
<select name="gender" id="gender-drop">
<option value="male">Male</option>
<option value="female">Female</option>
</select>
</section>
<section id="dropdown-section">
<label for="dropdown">Which course did you take?</label><br />
<select required="required" name="course" id="dropdown" size="1">
<option value="level1">Beginner Course</option>
<option value="level2">Beginner-Intermediate Course</option>
<option value="level3">Intermediate Course</option>
<option value="level4">Advanced Course</option>
<option value="level5">Expert Course</option>
</select>
</section>
<br />
<section id="range-section">
<label for="range">How was your experience?</label><br />
<small>Terrible!</small>
<input type="range" required="required" id="range" name="range" min="0" max="4" value="0" /><small>Excellent!</small>
</section>
<section id="sect-2">
<label for="y/n"> Would you recommend this course to a friend?</label><br />
<label for="yes">
<input type="radio" required="required" id="yes" name="y/n" value="Yes" checked="checked" />
Yes
</label><br />
<label for="no">
<input type="radio" required="required" id="no" name="y/n" value="No" /> No
</label><br />
<label for="maybe">
<input type="radio" required="required" id="maybe" name="y/n" value="Maybe" /> Maybe
</label><br />
</section>
<section id="sect-3">
<p>What would you like to see improved? <span>(Check all that apply)</span></p>
<label for="improve1">
<input type="checkbox" id="improve1" name="improve1" value="Layout" /> Course
Layout/Paths
</label><br />
<label for="improve2">
<input type="checkbox" id="improve2" name="improve2" value="Videos" /> Course
Videos/Instruction
</label><br />
<label for="improve3">
<input type="checkbox" id="improve3" name="improve3" value="Community" />
Community Features
</label><br />
<label for="improve4">
<input type="checkbox" id="improve4" name="improve4" value="Support-Help" /> Support
</label><br />
<label for="improve5">
<input type="checkbox" id="improve5" name="improve5" value="Other" /> Other
</label>
</section>
<section id="sect-4">
<!-- <label id="txt-label" for="textarea">Any extra comments are welcome!</label> -->
<textarea rows="4" cols="50" id="textarea" placeholder="Any extra comments, suggestions, and complaints go here."></textarea><br />
<input id="submit" type="submit" value="Submit" style="color: white;" />
</section>
</form>
</div>
I took the previous media queries out and just gave the sections those styles.
section#sect-2,
section#sect-3 {
text-align: left;
display: inline-block;
}
I also added <br> which is a line break element under your #dropdown-section next to your closing section tag.
#import url('https://fonts.googleapis.com/css2?family=Playfair+Display&family=Quicksand&display=swap');
* {
box-sizing: border-box;
text-align: center;
font-family: 'Playfair Display', serif;
font-family: 'Quicksand', sans-serif;
}
body {
background: linear-gradient(40deg, transparent 40%, rgb(41, 39, 39)),
linear-gradient(-40deg, rgb(78, 75, 75) 20%, #81777d 90%);
}
header {
color: white;
}
div {
background-color: rgb(68, 65, 65);
padding: 35px;
opacity: 200%;
margin: 0 30px;
border: rgb(41, 39, 39) solid 3px;
border-radius: 3px;
margin-bottom: 20px;
}
form {
color: white;
}
#sect-1 label {
margin: 0 0 15px;
color: white;
}
#sect-1 input {
border: white;
width: 50%;
border-radius: 2px;
padding: 10px;
margin: 15px;
}
select {
border: white;
width: 50%;
color: #4d4a4a;
border-radius: 1px;
padding: 10px;
margin: 15px;
color: black;
}
span {
font-style: italic;
opacity: 80%;
}
select option {
color: black;
}
#range {
width: 50%;
}
input[type=checkbox] {
-ms-transform: scale(1.5);
/* IE */
-moz-transform: scale(1.5);
/* FF */
-webkit-transform: scale(1.5);
/* Safari and Chrome */
-o-transform: scale(1.5);
/* Opera */
transform: scale(1.5);
}
input[type=radio] {
/* IE */
-ms-transform: scale(1.4);
/* FF */
-moz-transform: scale(1.4);
/* Safari and Chrome */
-webkit-transform: scale(1.4);
/* Opera */
-o-transform: scale(1.4);
transform: scale(1.4);
position: absolute;
left: 300px;
}
textarea {
padding: 5px;
margin: auto;
/* IE */
-ms-transform: scale(1.4);
/* FF */
-moz-transform: scale(1.4);
/* Safari and Chrome */
-webkit-transform: scale(1.4);
/* Opera */
-o-transform: scale(1.4);
transform: scale(1.4);
color: black;
margin-bottom: 50px;
margin-top: 50px;
text-align: left;
}
label {
margin-top: 30px;
margin-bottom: 5px;
}
#sect-1{
color: black;
}
input[type=submit] {
background-color: rgb(41, 39, 39);
border: rgb(41, 39, 39) 10px solid;
width: 50%;
margin-top: 10px;
border-radius: 5px;
}
input[type=submit]:hover {
background-color: rgb(110, 108, 108);
border: 10px solid rgb(110, 108, 108);
cursor: pointer;
}
#range-section{
margin-bottom: 15px;
}
#sect-2, #sect-3{
display: flex;
}
#sect-2, #sect-3 label{
position: relative;
}
section#sect-2,
section#sect-3 {
text-align: left;
display: inline-block;
}
<header>
<h1 id="title">Art Course Survey Page</h1>
<p id="description">Any feedback would be appreciated.</p>
</header>
<div>
<form id="survey-form" action="#" method="post">
<section id="sect-1">
<label id="name-label" for="name">Name</label><br />
<input type="text" name="name" id="name" placeholder="Enter your name" required="required" /><br />
<label id="email-label" for="email">Email</label><br />
<input type="email" name="email" id="email" placeholder="Enter your email address" required="required" /><br />
<label id="number-label" for="number">Age <span>(optional)</span></label><br />
<input type="number" name="number" id="number" placeholder="Age" min="1" max="99" /><br />
<label id="gender" for="gender-drop">Gender <span>(optional)</span></label><br />
<select name="gender" id="gender-drop">
<option value="male">Male</option>
<option value="female">Female</option>
</select>
</section>
<section id="dropdown-section">
<label for="dropdown">Which course did you take?</label><br />
<select required="required" name="course" id="dropdown" size="1">
<option value="level1">Beginner Course</option>
<option value="level2">Beginner-Intermediate Course</option>
<option value="level3">Intermediate Course</option>
<option value="level4">Advanced Course</option>
<option value="level5">Expert Course</option>
</select>
</section>
<br>
<section id="range-section">
<label for="range">How was your experience?</label><br />
<small>Terrible!</small>
<input type="range" required="required" id="range" name="range" min="0" max="4" value="0" /><small>Excellent!</small>
</section>
<section id="sect-2">
<label for="y/n"> Would you recommend this course to a friend?</label><br />
<label for="yes">
<input type="radio" required="required" id="yes" name="y/n" value="Yes" checked="checked" />
Yes
</label><br />
<label for="no">
<input type="radio" required="required" id="no" name="y/n" value="No" /> No
</label><br />
<label for="maybe">
<input type="radio" required="required" id="maybe" name="y/n" value="Maybe" /> Maybe
</label><br />
</section><br>
<section id="sect-3">
<p>What would you like to see improved? <span>(Check all that apply)</span></p>
<label for="improve1">
<input type="checkbox" id="improve1" name="improve1" value="Layout" /> Course
Layout/Paths
</label><br />
<label for="improve2">
<input type="checkbox" id="improve2" name="improve2" value="Videos" /> Course
Videos/Instruction
</label><br />
<label for="improve3">
<input type="checkbox" id="improve3" name="improve3" value="Community" />
Community Features
</label><br />
<label for="improve4">
<input type="checkbox" id="improve4" name="improve4" value="Support-Help" /> Support
</label><br />
<label for="improve5">
<input type="checkbox" id="improve5" name="improve5" value="Other" /> Other
</label>
</section>
<section id="sect-4">
<!-- <label id="txt-label" for="textarea">Any extra comments are welcome!</label> -->
<textarea rows="4" cols="50" id="textarea" placeholder="Any extra comments, suggestions, and complaints go here."></textarea><br />
<input id="submit" type="submit" value="Submit" style="color: white;" />
</section>
</form>
</div>

HTML form field won't keep pseudoclass

I have the following form:
body {
background: #fff;
color: 404040
}
form {
display: block;
position: relative;
width: 80%;
background: #f9f9f9;
margin: 10px auto;
padding: 30px;
}
label {
display: block;
position: relative;
top: -20px;
left: 0px;
color: #999;
font-family: 'Helvetica', sans-serif;
font-size: 16px;
z-index: 1;
transition: all 0.3s ease-out;
}
input,
input:optional {
display: block;
position: relative;
background: none;
border: none;
border-bottom: 1px solid #ddd;
width: 100%;
font-family: 'Helvetica', sans-serif;
font-weight: bold;
font-size: 16px;
z-index: 2;
}
input:focus,
input:valid {
outline: none;
border-bottom: 1px solid #00aced;
}
input:focus+label,
input:required:valid+label {
top: -40px;
font-size: 11px;
color: #00aced;
}
.divider {
position: relative;
height: 30px;
width: auto;
background: none;
}
#hex1 {
width: 75px;
margin: 10px auto;
}
.headline {
margin-left: 100px;
font-size: 24px;
}
.submitBtn {
width: 250px;
height: 75px;
border-radius: 3px;
background: #37afac;
margin: 0 auto;
color: #fff
}
#title {
margin-top: -60px;
margin-left: 80px;
margin-bottom: 20px;
}
<form>
<h3>Details about the person you are reporting:</h3>
<div class='divider'></div>
<input type="text" name="firstname" required autocomplete="off" />
<label for="firstname">First Name</label>
<div class='divider'></div>
<input type="text" name="lastname" required autocomplete="off" />
<label for="lastname">Last Name</label>
<div class='divider'></div>
<input type="text" name="age" class="test" autocomplete="off" />
<label for="age">Age</label>
<div class='divider'></div>
<input type="text" name="gender" required autocomplete="off" />
<label for="gender">Gender</label>
<div class='divider'></div>
<input type="text" name="address 1" autocomplete="off" />
<label for="address1">Address 1</label>
<div class='divider'></div>
<input type="text" name="address 2" autocomplete="off" />
<label for="address2">Address 2</label>
<div class='divider'></div>
<input type="text" name="city" required autocomplete="off" />
<label for="city">City</label>
<div class='divider'></div>
<input type="text" name="state" required autocomplete="off" />
<label for="state">State</label>
<div class='divider'></div>
<input type="text" name="position" autocomplete="off" />
<label for="Position">Position (coach, referee, etc)</label>
<div class='divider'></div>
<input type="text" name="program" required autocomplete="off" />
<label for="Program">Program where individual works</label>
<div class='divider'></div>
<input type="text" name="IncidentDescription" required autocomplete="off" />
<label for="IncidentDescription">Incident description</label>
<div class='divider'></div>
<input type="text" name="IncidentLocation" required autocomplete="off" />
<label for="IncidentLocation">Incident location</label>
<div class='divider'></div>
Codepen: https://codepen.io/anon/pen/PazrBw
As each input receives focus, it animates via receiving a class in css. Using basic html5 validation, it's supposed to retain that class to show that it's been properly filled out.
My problem is that I need some fields to be not required. When fields are not marked required, the form automatically applies some of the :valid pseudoclass (the blue underline). The even bigger issue is that when it loses focus, it loses that class and collapses the label back down onto the input text.
What am I missing here? thank you!
You are not missing anything, it all behaves the way it's supposed to be based on your code. So you need an alternative approach.
I suggest using :placeholder-shown selector instead of :valid. This way, empty optional fields will no longer get selected.
To make this work, you first need to add placeholder=" " to your inputs. This feels a bit hacky because this way you are losing the ability to use placeholders in case you need them but remember that you are already saying no to using placeholders by putting labels in their place (well, if you ever need to include placeholders for the sake of accessibility, do it, and instead of empty placeholders put real ones, then hide them with CSS. Another topic, another time).
:placeholder-shown does not have IE/old browser support so we'll go with a good example of progressive enhancement here:
Label text will be already minimised and positioned on top of the input as a default (that is top: -40px; font-size: 11px;) so that it does not mess with user input. I believe that is good enough for IE/old browsers.
Then we add the nice animation effect for browsers that do support :placeholder-shown by including following styles:
input:not(:focus):placeholder-shown + label {
top: -20px;
font-size: 16px;
}
:not(:focus) is necessary to resize and reposition label as soon as user focuses an input because some browsers show placeholder even after focus (and hide it only after user starts typing).
body {
background: #fff;
color: 404040
}
form {
display: block;
position: relative;
width: 80%;
background: #f9f9f9;
margin: 10px auto;
padding: 30px;
}
label {
display: block;
position: relative;
/* top: -20px; */
top: -40px;
left: 0px;
color: #999;
font-family: 'Helvetica', sans-serif;
/* font-size: 16px; */
font-size: 11px;
z-index: 1;
transition: all 0.3s ease-out;
}
input/*,
input:optional */ {
display: block;
position: relative;
background: none;
border: none;
border-bottom: 1px solid #ddd;
width: 100%;
font-family: 'Helvetica', sans-serif;
font-weight: bold;
font-size: 16px;
z-index: 2;
}
input:focus/*,
input:valid*/ {
outline: none;
border-bottom: 1px solid #00aced;
}
input:focus+label/*,
input:required:valid+label*/ {
color: #00aced;
}
/* New styles >> */
input:not(:focus):placeholder-shown + label {
top: -20px;
font-size: 16px;
}
/* << */
.divider {
position: relative;
height: 30px;
width: auto;
background: none;
}
#hex1 {
width: 75px;
margin: 10px auto;
}
.headline {
margin-left: 100px;
font-size: 24px;
}
.submitBtn {
width: 250px;
height: 75px;
border-radius: 3px;
background: #37afac;
margin: 0 auto;
color: #fff
}
#title {
margin-top: -60px;
margin-left: 80px;
margin-bottom: 20px;
}
<form>
<h3>Details about the person you are reporting:</h3>
<div class='divider'></div>
<input placeholder=" " type="text" name="firstname" required autocomplete="off" />
<label for="firstname">First Name</label>
<div class='divider'></div>
<input placeholder=" " type="text" name="lastname" required autocomplete="off" />
<label for="lastname">Last Name</label>
<div class='divider'></div>
<input placeholder=" " type="text" name="age" class="test" autocomplete="off" />
<label for="age">Age</label>
<div class='divider'></div>
<input placeholder=" " type="text" name="gender" required autocomplete="off" />
<label for="gender">Gender</label>
<div class='divider'></div>
<input placeholder=" " type="text" name="address 1" autocomplete="off" />
<label for="address1">Address 1</label>
<div class='divider'></div>
<input placeholder=" " type="text" name="address 2" autocomplete="off" />
<label for="address2">Address 2</label>
<div class='divider'></div>
<input placeholder=" " type="text" name="city" required autocomplete="off" />
<label for="city">City</label>
<div class='divider'></div>
<input placeholder=" " type="text" name="state" required autocomplete="off" />
<label for="state">State</label>
<div class='divider'></div>
<input placeholder=" " type="text" name="position" autocomplete="off" />
<label for="Position">Position (coach, referee, etc)</label>
<div class='divider'></div>
<input placeholder=" " type="text" name="program" required autocomplete="off" />
<label for="Program">Program where individual works</label>
<div class='divider'></div>
<input placeholder=" " type="text" name="IncidentDescription" required autocomplete="off" />
<label for="IncidentDescription">Incident description</label>
<div class='divider'></div>
<input placeholder=" " type="text" name="IncidentLocation" required autocomplete="off" />
<label for="IncidentLocation">Incident location</label>
<div class='divider'></div>

CSS only radio buttons not being checked on click

CSS only, I prefer not to add any additional JS. The 2nd radio button is not being "checked" when clicked.
Here's fiddle already created.
HTML:
<div class="account-container">
<div class="form-group">
<div class="control-container clearfix">
<div class="col-md-4 radio">
<input type="radio" name="Gender" value="Mujer" checked />
<label>Mujer</label>
</div>
<div class="col-md-4 radio">
<input type="radio" name="Gender" value="Hombre" />
<label>Hombre</label>
</div>
</div>
</div>
</div>
CSS:
.account-container .radio {
height: 100%;
margin: 0;
}
.account-container .radio label {
position: relative;
line-height: 40px;
cursor: pointer;
padding-left: 30px;
}
.account-container .radio label:before {
content: " ";
display: inline-block;
width: 22px;
height: 22px;
position: absolute;
left: 0;
top: 9px;
border: 1px solid #1fb5e1;
background-color: #fff;
border-radius: 50%;
}
.account-container .radio input[type="radio"]:checked + label:after {
background-color: #1fb5e1;
width: 14px;
height: 14px;
border-radius: 50%;
position: absolute;
content: " ";
left: 5px;
top: 14px;
}
<input type="radio" id="id_of_radio">
<label for="id_of_radio">
The issue is the position of your radio items, since they are not visible, you cannot click on it.
You should use the capability of the label, when you click on it, the bounded element is selected.
http://jsfiddle.net/fvzegu6o/1/
<div class="col-md-4 radio">
<input type="radio" name="Gender" value="Mujer" id="mujer" checked />
<label for="mujer">Mujer</label>
</div>
<div class="col-md-4 radio">
<input type="radio" name="Gender" value="Hombre" id="hombre" />
<label for="hombre">Hombre </label>
</div>

How can I customize css for radio buttons

I would like to replace the default view of radio buttons by customizing it. So, I would like to toggle between two images(as I am not good with css3 animations, so i chose to do the job with images).
So for check state I would like to display (check.png):
And when the radio button is unchecked I would like to display (uncheck.png):
HTML CODE:
currently I am using the following bootstrap markup:
<section class="lineHeight">
<div class="radio">
<label>
<input type="radio" name="auditTool" id="optionsRadios1" value="option1">
<span class="outer"><span class="inner"></span></span>Large
</label>
</div>
</section>
CSS:
.lineHeight{
line-height:56px;
}
.lineHeight .radio input[type=radio]{
position: absolute;
top: 50%;
margin-top: -6px;
margin-left: -20px;
}
You can hide the native radio and display a custom one with CSS.
input[type=radio] {
display: none;
}
input[type=radio] + label:before {
content: '';
display: inline-block;
border: 2px solid #0F81D5;
height: 12px;
width: 12px;
border-radius: 50%;
}
label:hover:before {
box-shadow: inset 0 0 5px orange;
}
input[type=radio]:checked + label:before {
border-width: 5px;
height: 6px;
width: 6px;
}
<div>
<input type="radio" name="radio" id="radio1" />
<label for="radio1">Foo</label>
</div>
<div>
<input type="radio" name="radio" id="radio2" />
<label for="radio2">Bar</label>
</div>
<div>
<input type="radio" name="radio" id="radio3" />
<label for="radio3">Baz</label>
</div>
input[type=radio].css-checkbox {
position: absolute;
z-index: -1000;
left: -1000px;
overflow: hidden;
clip: rect(0 0 0 0);
height: 1px;
width: 1px;
margin: -1px;
padding: 0;
border: 0;
}
input[type=radio].css-checkbox + label.css-label {
padding-left: 23px;
height: 18px;
display: inline-block;
line-height: 18px;
background-repeat: no-repeat;
background-position: 0 0;
font-size: 18px;
vertical-align: middle;
cursor: pointer;
}
input[type=radio].css-checkbox:checked + label.css-label {
background-position: 0 -18px;
}
label.css-label {
background-image: url(http://csscheckbox.com/checkboxes/u/csscheckbox_67c83917465692304d237c7e9e0533ca.png);
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>CSS Checkbox Demo from CSSCheckbox.com</title>
<link rel="stylesheet" href="style.css" />
<style type="text/css">
/*this is just to organize the demo checkboxes*/
label {
margin-right: 20px;
}
</style>
</head>
<body>
<h1 style="margin:0; margin-top:10px; padding:0; padding-left:25px; padding-bottom:10px; font-family:sans-serif;">CSS Checkboxes!</h1>
<div style="background:#444; color:#fafafa; padding:10px;">
<h3>Dark Background</h3>
<table>
<tr>
<td>
<input type="radio" name="radiog_lite" id="radio1" class="css-checkbox" />
<label for="radio1" class="css-label radGroup1">Option 1</label>
</td>
<td>
<input type="radio" name="radiog_lite" id="radio2" class="css-checkbox" checked="checked" />
<label for="radio2" class="css-label radGroup1">Option 2</label>
</td>
<td>
<input type="radio" name="radiog_lite" id="radio3" class="css-checkbox" />
<label for="radio3" class="css-label radGroup1">Option 1</label>
</td>
</tr>
</table>
</div>
<div style="background:#fafafa; color:#222; padding:10px;">
<h3>Light Background</h3>
<table>
<tr>
<td>
<input type="radio" name="radiog_dark" id="radio4" class="css-checkbox" />
<label for="radio4" class="css-label radGroup2">Option 1</label>
</td>
<td>
<input type="radio" name="radiog_dark" id="radio5" class="css-checkbox" checked="checked" />
<label for="radio5" class="css-label radGroup2">Option 2</label>
</td>
<td>
<input type="radio" name="radiog_dark" id="radio6" class="css-checkbox" />
<label for="radio6" class="css-label radGroup2">Option 1</label>
</td>
</tr>
</table>
</div>
<p style="padding-left:25px;">Radio Button generated by CSS Checkbox
</p>
</body>
</html>
Reference: http://www.csscheckbox.com/radio-buttons/0/

Label would not align vertically with section

I can't figure out a way to align Provinces vertically beside section. I tried using height auto on label also a couple of css display but nothing would work. I just want Provinces to be vertically in the middle beside section which has provinces with option tag. Any help will be appreciated.
<label class="lselect" for="province">Province: </label>
<select name="province" size="2">
<optgroup label="Province">
<option value="alberta">Alberta</option>
<option value="bc">British Colombia</option>
<option value="manitoba">Manitoba</option>
<option value="newbrunswick">New Brunswick</option>
</optgroup>
</select>
http://jsfiddle.net/rbamwdvb/
May not be the best solution but one solution is:
.lselect{
vertical-align: 35px;
}
Sobasofy your code are fine and your css is okay all you need is to remove the size attribute for select and use css to size it back.
<label class="lselect" for="province">Province: </label>
<select name="province" style="height:40px;width:200px">
<optgroup label="Province">
<option value="alberta">Alberta</option>
<option value="bc">British Colombia</option>
<option value="manitoba">Manitoba</option>
<option value="newbrunswick">New Brunswick</option>
</optgroup>
</select>
I have done it and it work just try it yourself
Wrap the label and select elements inside two different divs and wrap them in another div. Then use display: inline-block and vertical-align to align them.
Demo on dabblet
<body>
<header>
<img src="logo.png" alt="Seneca" width="195px" height="43px">
<h1>Coop Program Application Form</h1>
<p id="validerr" class="validerr">Required fields are followed by *.</p>
</header>
<form name="senecaform" method="post" action="" onreset="alert('The form will be reset')">
<!--onsubmit='return validator(this)'-->
<p class="info">Basic Information</p>
<div>
<label for="fname">First Name:</label>
<input type="text" name="fname" size="35" autofocus="autofocus" required="required">
</br>
<label for="lname">Last Name:</label>
<input type="text" name="lname" size="35" required="required">
</br>
<label for="studid">Student ID:</label>
<input type="text" name="studid" size="35" maxlength="10" required="required">
</br>
<label for="learnid">Learn ID:</label>
<input type="text" name="learnid" size="35" required="required">
</br>
<label for="email">Student ID:</label>
<input type="text" name="email" size="35" required="required">
</br>
<label for="phonenum">Phone Number:</label>
<input type="text" name="phonenum" placeholder="(999) 999-9999" size="35" required="required">
</br>
<label for="address">Address:</label>
<input type="text" name="address" size="35" maxlength="10" required="required">
</br>
<label for="city">City:</label>
<input type="text" name="city" size="35" maxlength="10" required="required">
</br>
<div class="provinceCont">
<div class="lbl">
<label class="lselect" for="province">Province:</label>
</div>
<div class="slct">
<select name="province" size="2">
<optgroup label="Province">
<option value="alberta">Alberta</option>
<option value="bc">British Colombia</option>
<option value="manitoba">Manitoba</option>
<option value="newbrunswick">New Brunswick</option>
</optgroup>
</select>
</div>
</div>
</div>
<button type="submit">submit</button>
<button type="reset">Reset</button>
</form>
</body>
CSS:
body{
width: 580px;
margin: auto;
margin-top: 5px;
padding: 45px 10px;
border: 1px solid #CBCBCB;
border-radius: 8px;
}
h1{
margin-top: 45px;
font-size: 22px;
font-weight: bold;
text-shadow: 3px 3px 2px grey;
height: 20px;
}
.validerr{
margin: 30px 0px;
}
form{
width: 580px ;
margin: 0 auto;
}
.info{
background-color: #9A9A9A;
font-weight: bold;
padding-left: 10px;
height: 18px;
padding-top: 2px;
}
div{
margin: 0 auto;
width: 400px;
text-align: right;
}
input{
height: 1.5em;
margin-left: 10px;
margin-top: 10px;
margin-bottom: 10px;
border: 1px solid #CBCBCB;
border-radius: 4px;
box-shadow: 3px 3px 4px grey;
}
.provinceCont, select {
display: inline-block;
}
.provinceCont {
height: 40px
width: 350px;
}
.lbl {
display: inline-block;
vertical-align: middle;
width: 60px;
height: 52px;
}
.slct {
display: inline-block;
height: 30px
line-height: 30px;;
width: 260px;
}
select{
width: 250px;
margin: 10px 0px 10px 10px;
border: 1px solid #CBCBCB;
border-radius: 4px;
box-shadow: 3px 3px 4px grey;
}
This is probably the best way to get this to work. If you use set units, such as pixels, the layout will break if the website is responsive.
CSS
.lselect {
float: left;
}

Resources