HTML form separate columns with borders - css

I have 4 columns and I need separate each column with borders. It looks like now:
How It should be (red/blue colors just for example):
Problem Is that I don't have any div for columns, I generating rows inside <li> </li> so 4 inputs inside <li> </li> is 1 row:
<form class="form-style-9">
<h2>Personal details</h2>
<ul>
<div id="personal-details">
<li>
<div class="test">
<label for="Rank">Rank</label>
<input id="Rank" type="text" name="Rank" class="field-style field-split25 align-left" placeholder="Rank" />
</div>
<div class="test">
<label for="RankApplied">Rank Applied</label>
<input id="RankApplied" type="text" name="RankApplied" class="field-style field-split25 align-left" placeholder="Rank Applied" />
</div>
<div class="test">
<label for="Vesselstype">Vessel's type</label>
<input id="Vesselstype" type="text" name="Vesselstype" class="field-style field-split25 align-left" placeholder="Vessel's type" />
</div>
<div class="test">
<label for="datepicker2">Date Applied</label>
<input id="datepicker2" type="date" name="datepicker2" class="field-style field-split25-4 align-left" placeholder="Date Applied" />
</div>
</li>
<li>
<div class="test">
<label for="fname">First Name</label>
<input id="fname" type="text" name="fname" class="field-style field-split25 align-left" placeholder="First Name" />
</div>
<div class="test">
<label for="nationality">Nationality</label>
<input id="nationality" type="text" name="nationality" class="field-style field-split25 align-left" placeholder="Nationality" />
</div>
<div class="test">
<label for="height">Height</label>
<input id="height" type="text" name="height" class="field-style field-split25 align-left" placeholder="Height" />
</div>
<div class="test">
<label for="na">Nearest airport</label>
<input id="na" type="text" name="na" class="field-style field-split25-4 align-left" placeholder="Nearest airport" />
</div>
</li>
<li>
<div class="test">
<label for="sname">Surename</label>
<input id="sname" type="text" name="sname" class="field-style field-split25 align-left" placeholder="Surename" />
</div>
<div class="test">
<label for="noc">No. of children</label>
<input id="noc" type="number" name="noc" class="field-style field-split25 align-left" placeholder="No. of children" />
</div>
<div class="test">
<label for="weight">Weight</label>
<input id="weight" type="number" name="weight" class="field-style field-split25 align-left" placeholder="Weight" />
</div>
<div class="test4">
<label for="languages">Languages</label>
<input id="languages" type="text" name="languages" class="field-style field-split25-4 align-left" placeholder="Languages" />
</div>
</li>
<li>
<div class="test">
<label for="datepicker">Date of Birth</label>
<input id="datepicker" type="date" name="datepicker" class="field-style field-split25 align-left" placeholder="Date of Birth" />
</div>
<div class="test">
<label for="nok">Next of kin</label>
<input id="nok" type="text" name="nok" class="field-style field-split25 align-left" placeholder="Next of kin" />
</div>
<div class="test">
<label for="coe">Color of eyes</label>
<input id="coe" type="text" name="coe" class="field-style field-split25 align-left" placeholder="Color of eyes" />
</div>
<div class="test4">
<label for="english">English</label>
<input id="english" type="text" name="english" class="field-style field-split25-4 align-left" placeholder="English" />
</div>
</li>
<li>
<div class="test">
<label for="pob">Place of Birth</label>
<input id="pob" type="text" name="pob" class="field-style field-split25-4 align-left" placeholder="Place of Birth" />
</div>
<div class="test">
<label for="nonok">Name of Next of Kin</label>
<input id="nonok" type="text" name="nonok" class="field-style field-split25 align-left" placeholder="Name of Next of Kin" />
</div>
<div class="test">
<label for="coh">Color of hair</label>
<input id="coh" type="text" name="coh" class="field-style field-split25 align-left" placeholder="Color of hair" />
</div>
<div class="test4">
<label for="german">German</label>
<input id="german" type="text" name="german" class="field-style field-split25-4 align-left" placeholder="German" />
</div>
</li>
<li>
<div class="test">
<label for="HomeAddress">Home Address</label>
<input id="HomeAddress" type="text" name="HomeAddress" class="field-style field-split25 align-left" placeholder="Home Address" />
</div>
<div class="test">
<label for="aonok">Address of Next of Kin</label>
<input id="aonok" type="text" name="aonok" class="field-style field-split25 align-left" placeholder="Address of Next of Kin" />
</div>
<div class="test">
<label for="os">Overall size</label>
<input id="os" type="text" name="os" class="field-style field-split25 align-left" placeholder="Overall size" />
</div>
<div class="test4">
<label for="spain">Spain</label>
<input id="spain" type="text" name="spain" class="field-style field-split25-4 align-left" placeholder="Spain" />
</div>
</li>
<li>
<div class="test">
<label for="TelNo">Telephone No.</label>
<input id="TelNo" type="text" name="TelNo" class="field-style field-split25 align-left" placeholder="Telephone No." />
</div>
<div class="test">
<label for="TelNo">Telephone No.</label>
<input id="TelNo" type="text" name="TelNo" class="field-style field-split25 align-left" placeholder="Telephone No." />
</div>
<div class="test">
<label for="sz">Shoe size</label>
<input id="sz" type="text" name="sz" class="field-style field-split25 align-left" placeholder="Shoe size" />
</div>
<div class="test4">
<label for="BankDetails">Bank Details</label>
<input id="BankDetails" type="text" name="BankDetails" class="field-style field-split25-4 align-left" placeholder="Bank Details" />
</div>
</li>
</div>
Have you any ideas how can I achieve that? Here is FIDDLE

If to keep your existing markup, here is an option (though you might need to adjust the values a little)
To be noted, having a <div id="personal-details"> as a direct child of ul is invalid markup and should be removed. You can put the id on the ul instead.
Updated fiddle
ul {
position: relative;
}
ul li:first-child .test:before {
content: ' ';
position: absolute;
display: block;
border: 1px solid red;
top: 0;
left: 0;
width: 23.5%;
height: 100%;
}
ul li:first-child .test:nth-child(2):before {
left: calc(23.5% + 1px);
width: 24%;
border: 1px solid blue;
}
ul li:first-child .test:nth-child(3):before {
left: calc(47.5% + 1px);
width: 24%;
}
ul li:first-child .test:nth-child(4):before {
left: calc(71.5% + 1px);
border: 1px solid blue;
}

If you strongly need to keep it as row-wise, you have the option of using absolutely positioned, divs.
#personal-details{
position: relative;
}
ul{
list-style: none;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
li{
width: 25%;
}
.parent{
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
}
.borders{
display: flex;
justify-content: space-between;
height: 40px;
}
.border{
border: 1px solid red;
width: 25%;
}
<div id="personal-details">
<ul>
<li>this is first</li>
<li>this is second</li>
<li>this is third</li>
<li>this is forth</li>
<li>this is first</li>
<li>this is second</li>
<li>this is third</li>
<li>this is forth</li>
</ul>
<div class="parent">
<div class="borders">
<div class="border"></div>
<div class="border"></div>
<div class="border"></div>
<div class="border"></div>
</div>
</div>
</div>
Note1
Please note that you should not put divs directly inside ul so this is incorrect:
<ul>
<div>
<li>Item</li>
<li>Item</li>
<li>Item</li>
</div>
</ul>
Note2
That would be a better practice if you produce them, column-wise, so that way you don't need to monkey with your CSS.
Desired markup
<ul id="personal-details">
<li>
<ul class="column">
<li>Rank</li>
<li>First name</li>
<li>Surname</li>
<li>Date of Birth</li>
<li>Place of Birth</li>
<li> ... </li>
<li> ... </li>
</ul>
</li>
<li>
<ul class="column">
<li>Rank</li>
<li>Nationality</li>
<li>No. of children</li>
<li>Next of kin</li>
<li>Name of Next of kin</li>
<li> ... </li>
<li> ... </li>
</ul>
</li>
<li> ... </li>
<li> ... </li>
</ul>
Solution
ul{
list-style: none;
}
#personal-details{
margin: auto;
display: flex;
justify-content: space-between;
}
#personal-details > li{
padding: 20px;
border: 1px solid red;
}
.column{
padding: 0;
text-align: center;
}
<ul id="personal-details">
<li>
<ul class="column">
<li>
<label for="Rank">Rank</label>
<input type="text" name="Rank" placeholder="Rank" />
</li>
<li>
<label for="Firstname">First name</label>
<input type="text" name="Firstname" placeholder="Firstname" />
</li>
<li>
<label for="Surname">Surname</label>
<input type="text" name="Surname" placeholder="Surname" />
</li>
<li>
<label for="Rank">Date of Birth</label>
<input type="text" name="DateofBirth" placeholder="DateofBirth" />
</li>
<li>
<label for="PlaceofBirth">Place of Birth</label>
<input type="text" name="PlaceofBirth" placeholder="Place of Birth" />
</li>
<li> ... </li>
<li> ... </li>
</ul>
</li>
<li>
<ul class="column">
<li>
<label for="RankApplied">Rank Applied</label>
<input type="text" name="RankApplied" placeholder="RankApplied" />
</li>
<li>
<label for="Nationality">Nationality</label>
<input type="text" name="Nationality" placeholder="Nationality" />
</li>
<li>
<label for="NoOfChildren">No. Of Children</label>
<input type="text" name="NoOfChildren" placeholder="NoOfChildren" />
</li>
<li>
<label for="NextOfKin">Next Of Kin</label>
<input type="text" name="NextOfKin" placeholder="NextOfKin" />
</li>
<li>
<label for="NameOfNextOfKin">Name of Next of kin</label>
<input type="text" name="NameOfNextOfKin" placeholder="NameOfNextOfKin" />
</li>
<li> ... </li>
<li> ... </li>
</ul>
</li>
<li>
<ul class="column">
<li>
<label for="Rank">Rank</label>
<input type="text" name="Rank" placeholder="Rank" />
</li>
<li>
<label for="Firstname">First name</label>
<input type="text" name="Firstname" placeholder="Firstname" />
</li>
<li>
<label for="Surname">Surname</label>
<input type="text" name="Surname" placeholder="Surname" />
</li>
<li>
<label for="Rank">Date of Birth</label>
<input type="text" name="DateofBirth" placeholder="DateofBirth" />
</li>
<li>
<label for="PlaceofBirth">Place of Birth</label>
<input type="text" name="PlaceofBirth" placeholder="Place of Birth" />
</li>
<li> ... </li>
<li> ... </li>
</ul>
</li>
<li>
<ul class="column">
<li>
<label for="RankApplied">Rank Applied</label>
<input type="text" name="RankApplied" placeholder="RankApplied" />
</li>
<li>
<label for="Nationality">Nationality</label>
<input type="text" name="Nationality" placeholder="Nationality" />
</li>
<li>
<label for="NoOfChildren">No. Of Children</label>
<input type="text" name="NoOfChildren" placeholder="NoOfChildren" />
</li>
<li>
<label for="NextOfKin">Next Of Kin</label>
<input type="text" name="NextOfKin" placeholder="NextOfKin" />
</li>
<li>
<label for="NameOfNextOfKin">Name of Next of kin</label>
<input type="text" name="NameOfNextOfKin" placeholder="NameOfNextOfKin" />
</li>
<li> ... </li>
<li> ... </li>
</ul>
</li>
</ul>

You can try to change that in following way.
<form class="form-style-9 clearfix">
<h2>Personal details</h2>
<ul>
<div id="personal-details">
<div class="col clearfix">
<div class="test">
<label for="Rank">Rank</label>
<input id="Rank" type="text" name="Rank" class="field-style field-split25 align-left" placeholder="Rank" />
</div>
<div class="test">
<label for="fname">First Name</label>
<input id="fname" type="text" name="fname" class="field-style field-split25 align-left" placeholder="First Name" />
</div>
<div class="test">
<label for="sname">Surename</label>
<input id="sname" type="text" name="sname" class="field-style field-split25 align-left" placeholder="Surename" />
</div>
<div class="test">
<label for="pob">Place of Birth</label>
<input id="pob" type="text" name="pob" class="field-style field-split25-4 align-left" placeholder="Place of Birth" />
</div>
</div>
<div class="col clearfix">
<div class="test">
<label for="RankApplied">Rank Applied</label>
<input id="RankApplied" type="text" name="RankApplied" class="field-style field-split25 align-left" placeholder="Rank Applied" />
</div>
<div class="test">
<label for="nationality">Nationality</label>
<input id="nationality" type="text" name="nationality" class="field-style field-split25 align-left" placeholder="Nationality" />
</div>
<div class="test">
<label for="noc">No. of children</label>
<input id="noc" type="number" name="noc" class="field-style field-split25 align-left" placeholder="No. of children" />
</div>
</div>
<div class="col clearfix">
<div class="test">
<label for="RankApplied">Rank Applied</label>
<input id="RankApplied" type="text" name="RankApplied" class="field-style field-split25 align-left" placeholder="Rank Applied" />
</div>
<div class="test">
<label for="nationality">Nationality</label>
<input id="nationality" type="text" name="nationality" class="field-style field-split25 align-left" placeholder="Nationality" />
</div>
<div class="test">
<label for="noc">No. of children</label>
<input id="noc" type="number" name="noc" class="field-style field-split25 align-left" placeholder="No. of children" />
</div>
</div>
<div class="col clearfix">
<div class="test">
<label for="RankApplied">Rank Applied</label>
<input id="RankApplied" type="text" name="RankApplied" class="field-style field-split25 align-left" placeholder="Rank Applied" />
</div>
<div class="test">
<label for="nationality">Nationality</label>
<input id="nationality" type="text" name="nationality" class="field-style field-split25 align-left" placeholder="Nationality" />
</div>
<div class="test">
<label for="noc">No. of children</label>
<input id="noc" type="number" name="noc" class="field-style field-split25 align-left" placeholder="No. of children" />
</div>
</div>
</form>
Blockquote
.form-style-9{
background: #FAFAFA;
padding: 30px;
margin: 50px auto;
box-shadow: 1px 1px 25px rgba(0, 0, 0, 0.35);
border-radius: 10px;
border: 6px solid #305A72;
}
.form-style-9 ul{
padding:0;
margin:0;
list-style:none;
}
.form-style-9 ul li{
display: block;
margin-bottom: 1.25%;
min-height: 58px;
}
.form-style-9 ul li .field-style{
box-sizing: border-box;
padding: 8px;
outline: none;
border: 1px solid #B0CFE0;
}
.form-style-9 ul li .field-style:focus{
box-shadow: 0 0 5px #B0CFE0;
border:1px solid #B0CFE0;
}
.form-style-9 ul li .field-split{
width: 49%;
}
.form-style-9 ul li .field-split25{
/* float: left;
width: 24%;
margin-right: 1.25%;*/
height: 40px;
}
.form-style-9 ul li .field-split25-4{
/*float: left;
width: 24%;
margin-right: 0;*/
height: 40px;
}
.form-style-9 ul li .field-full{
width: 100%;
}
.form-style-9 ul li input.align-left{
/*float:left;*/
}
.form-style-9 ul li input.align-right{
float:right;
}
.form-style-9 ul li textarea{
width: 100%;
height: 100px;
}
.form-style-9 ul li input[type="button"],
.form-style-9 ul li input[type="submit"] {
box-shadow: inset 0px 1px 0px 0px #3985B1;
background-color: #216288;
border: 1px solid #17445E;
display: inline-block;
cursor: pointer;
color: #FFFFFF;
padding: 8px 18px;
text-decoration: none;
font: 12px Arial, Helvetica, sans-serif;
}
.form-style-9 ul li input[type="button"]:hover,
.form-style-9 ul li input[type="submit"]:hover {
background: linear-gradient(to bottom, #2D77A2 5%, #337DA8 100%);
background-color: #28739E;
}
.formcol{
float: left;
padding: 2px;
}
.formcol label {
font-weight: bold;
display:block;
}
ul {
margin: 0;
padding: 0;
list-style-type: none;
}
.test {
margin-right: 1.25%;
margin-bottom: 1.25%;
}
.image-div {
margin-right: 4%;
float:right;
width: 200px;
height: 200px;
}
.image-upload {
float:right;
width: 100%;
margin-right: 1.25%;
margin-bottom: 1.25%;
}
.image-preview {
float:right;
width: 150px;
height: 150px;
margin-right: 1.25%;
margin-bottom: 1.25%;
position:relative;
border: 1px solid #B0CFE0;
}
.test4 {
float:left;
width: 23%;
margin-right: 0;
margin-bottom: 1.25%;
}
.test-label {
width: 23%;
margin-right: 1.25%;
margin-bottom: 0px;
padding:0px;
font-weight: bold;
}
.test-label1 {
width: 23%;
margin-right: 1.25%;
margin-bottom: 0px;
padding:0px;
}
.removeRow{
height:auto;
width:auto;
max-width:12px;
max-height:12px;
}
.div-format-30 {
width: 90%;
margin-right: 1.25%;
margin-bottom: 0;
margin-top: 1.25%;
border: 1px solid #B0CFE0;
}
.div-format-30 td{
margin-top:20px;
float:left;
width: 90%;
margin-right: 1.25%;
margin-bottom: 0;
margin-top: 1.25%;
border: 1px solid #B0CFE0;
}
.split33 {
float:left;
width: 28%;
margin-right: 1.25%;
margin-bottom: 1.25%;
}
.split33right {
float:right;
width: 23%;
margin-right: 0;
margin-bottom: 1.25%;
}
.div-format {
font-size:12px;
float:left;
width: 23%;
margin-right: 1.25%;
margin-bottom: 1.25%;
border: 1px solid #B0CFE0;
}
.test4 {
float:left;
width: 23%;
margin-right: 0;
margin-bottom: 1.25%;
}
.header {
float:left;
width: 100%;
margin-right: 1.25%;
margin-bottom: .25%;
}
label {
display: block;
text-align: center;
}
input {
width: 100%;
}
.form-style-9 ul li input[type="submit"] {
width: 10%;
}
.resume-title {
color: #af5d86;
}
.container {
margin-left: 2%;
margin-right: 2%;
}
.personal-details {
padding-bottom:1.25%;
}
.col{
float: left;
width: 23%;
margin-right: 1.25%;
margin-bottom: 1.25%;
border: 1px solid #c2c2c2;
padding: 1%;
}

You must to do this :
1) make li vertical and change content in your example to specific it vertically .
2) but id to all li and in css make the border like this
<li id='first-column'> any thing</li>
<li id='second-column'> any thing</li>
css=>
#first-column { border:1px red solid; }
#second-column { border:1px blue solid; }

Related

unable to change background color of disabled checkbox

I tried the following:
input[type="checkbox"]:disabled {
background-color:blue;
}
but it's not working.
form{
border:solid 2px darkblue;
width:60%;
padding-bottom:3%;
margin:0 auto;
}
#container{
display:flex;
flex-wrap:wrap;
justify-content:center;
margin:0 auto;
}
.info{
margin:2% 3%;
}
.contact{
display:flex;
flex-direction:column;
margin-bottom:1%;
width:50%;
font-size:1.5vw;
}
.alerts{
width:100%;
font-size:1.5vw;
text-align:left;
margin-left:3%;
color:red;
}
p.alerts{
text-align:center;
margin-top:1%;
margin-bottom:5%;
margin-left:0;
}
.hidden{
visibility:hidden;
}
.row{
display:flex;
justify-content:space-between;
width:80%;
margin:0 auto;
}
.col{
display:flex;
flex-direction:column;
}
#skippers{
display:flex;
flex-direction:row;
Justify-content:center;
align-items:center;
margin-bottom:3%;
}
.skippers{
margin: 0 3%;
}
input[type="checkbox"]:disabled {
background-color:blue;
}
input[type='submit']{
color:white;
background-color: blue;
font-weight:bold;
}
<h1>Registration</h1>
<form action='register.php' method='POST'>
<h2>Enter contact info</h2>
<div id='container'>
<div class='contact'>
<input class='info' type='text' name='fname' placeholder='first name'>
<span class='alerts hidden'>Please enter your first name</span>
</div>
<div class='contact'>
<input class='info' type='text' name='lname' placeholder='last name'>
<span class='alerts hidden'>Please enter your last name</span>
</div>
<div class='contact'>
<input class='info' type='tel' name='phone' placeholder='mobile phone number'>
<span class='alerts hidden'>Please enter your mobile phone number</span>
</div>
<div class='contact'>
<input class='info' type='email' name='email' placeholder='email'>
<span class='alerts hidden'>Please enter your email</span>
</div>
<div class='contact'>
<input class='info' type='password' name='password' placeholder='password'>
<span class='alerts hidden'>Please enter your password</span>
</div>
<div class='contact'>
<input class='info' type='password' name='confirm' placeholder='confirm password'>
<span class='alerts hidden'>Please enter your password</span>
</div>
</div>
<h2>Days available to sail</h2>
<div class='row'>
<div class='col'>
<label for="MO">M</label>
<input class='dow' type="checkbox" name="MO">
</div>
<div class='col'>
<label for="TU">T</label>
<input class='dow' type="checkbox" name="TU">
</div>
<div class='col'>
<label for="WE">W</label>
<input class='dow' type="checkbox" name="WE">
</div>
<div class='col'>
<label for="TH">T</label>
<input class='dow' type="checkbox" name="TH">
</div>
<div class='col'>
<label for="FR">F</label>
<input class='dow' type="checkbox" name="FR">
</div>
<div class='col'>
<label for="SA">S</label>
<input class='dow' type="checkbox" name="SA">
</div>
<div class='col'>
<label for="SU">S</label>
<input class='dow' type="checkbox" name="SU">
</div>
</div>
<p class='alerts hidden'>Please select at least 1 day</p>
<h2>Select Skippers</h2>
<div id='skippers'>
<p class='skippers'>David Cross</p>
<input class='skippers' type='checkbox' checked required disabled style="background-color:red">
</div>
<input type='submit' value = 'SUBMIT' name='mySubmit'>
</fom>
</div>
<script src="../public/js/register.js" type="text/javascript"></script>
</body>
</html>
I'm proposing a different solution, which preserves accessibility and still allows for the styling of your choice.
Instead of using the disabled attribute on the checkbox, which ostensibly makes it impossible to override the background-color, add aria-disabled="true", which allows for visitors on screen-readers to correctly identify the element as disabled.
<input class='skippers' aria-disabled="true" type='checkbox' checked required>
<!-- ~~~~~~~~~~~~~~~~~~~ -->
As for the majority of visitors viewing our form elements inside a more common browser, we can ignore all clicks on the checkbox.
input[type="checkbox"][aria-disabled="true"] {
background-color: blue;
pointer-events: none;
}
form {
border: solid 2px darkblue;
width: 60%;
padding-bottom: 3%;
margin: 0 auto;
}
#container {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin: 0 auto;
}
.info {
margin: 2% 3%;
}
.contact {
display: flex;
flex-direction: column;
margin-bottom: 1%;
width: 50%;
font-size: 1.5vw;
}
.alerts {
width: 100%;
font-size: 1.5vw;
text-align: left;
margin-left: 3%;
color: red;
}
p.alerts {
text-align: center;
margin-top: 1%;
margin-bottom: 5%;
margin-left: 0;
}
.hidden {
visibility: hidden;
}
.row {
display: flex;
justify-content: space-between;
width: 80%;
margin: 0 auto;
}
.col {
display: flex;
flex-direction: column;
}
#skippers {
display: flex;
flex-direction: row;
Justify-content: center;
align-items: center;
margin-bottom: 3%;
}
.skippers {
margin: 0 3%;
}
input[type="checkbox"]:disabled {
background-color: blue;
}
input[type='submit'] {
color: white;
background-color: blue;
font-weight: bold;
}
input[type="checkbox"][aria-disabled="true"] {
background-color: blue;
pointer-events: none;
}
<h1>Registration</h1>
<form action='register.php' method='POST'>
<h2>Enter contact info</h2>
<div id='container'>
<div class='contact'>
<input class='info' type='text' name='fname' placeholder='first name'>
<span class='alerts hidden'>Please enter your first name</span>
</div>
<div class='contact'>
<input class='info' type='text' name='lname' placeholder='last name'>
<span class='alerts hidden'>Please enter your last name</span>
</div>
<div class='contact'>
<input class='info' type='tel' name='phone' placeholder='mobile phone number'>
<span class='alerts hidden'>Please enter your mobile phone number</span>
</div>
<div class='contact'>
<input class='info' type='email' name='email' placeholder='email'>
<span class='alerts hidden'>Please enter your email</span>
</div>
<div class='contact'>
<input class='info' type='password' name='password' placeholder='password'>
<span class='alerts hidden'>Please enter your password</span>
</div>
<div class='contact'>
<input class='info' type='password' name='confirm' placeholder='confirm password'>
<span class='alerts hidden'>Please enter your password</span>
</div>
</div>
<h2>Days available to sail</h2>
<div class='row'>
<div class='col'>
<label for="MO">M</label>
<input class='dow' type="checkbox" name="MO">
</div>
<div class='col'>
<label for="TU">T</label>
<input class='dow' type="checkbox" name="TU">
</div>
<div class='col'>
<label for="WE">W</label>
<input class='dow' type="checkbox" name="WE">
</div>
<div class='col'>
<label for="TH">T</label>
<input class='dow' type="checkbox" name="TH">
</div>
<div class='col'>
<label for="FR">F</label>
<input class='dow' type="checkbox" name="FR">
</div>
<div class='col'>
<label for="SA">S</label>
<input class='dow' type="checkbox" name="SA">
</div>
<div class='col'>
<label for="SU">S</label>
<input class='dow' type="checkbox" name="SU">
</div>
</div>
<p class='alerts hidden'>Please select at least 1 day</p>
<h2>Select Skippers</h2>
<div id='skippers'>
<p class='skippers'>David Cross</p>
<input class='skippers' aria-disabled="true" type='checkbox' checked required>
</div>
<input type='submit' value='SUBMIT' name='mySubmit'>
</fom>
</div>
<script src="../public/js/register.js" type="text/javascript"></script>
</body>
</html>
It's actually not that you can't style the :disabled state of a checkbox. It's more that you can't style much on a checkbox input at all. You'll see if I do the same style, but remove the :disabled state, the regular checkboxes are still the default color (on most browsers). The size is applied, but not the background-color.
input[type=checkbox]
{
width: 50px;
height: 50px;
background-color: red;
}
<input type="checkbox"/>
This is entirely up to the developer of the browser to implement, and as such it varies widely between all of them, but you can expect many CSS properties to be ineffective on a checkbox.
The typical solution to a problem like this is to implement your own custom checkbox element. At its core it's quite simple, having only a single boolean state that changes when you click on it.
Further reading

Select a container of a radio button list when a button gets selected

I have several containers with radio buttons. I want a container of a selected radio button to become selected:
input[type="radio"]:checked+.container {
border: 5px solid red;
}
<div class="container">
<input class="btn-radio" type="radio" value="123" name="rd" />
</div>
<div class="container">
<input class="btn-radio" type="radio" value="1234" name="rd" />
</div>
<div class="container">
<input class="btn-radio" type="radio" value="12345" name="rd" />
</div>
Why doesn't it work?
Here is the working code which I commented above
input[type="radio"]:checked + .border {
border: 5px solid red;
}
.container {
position: relative;
max-width: 100px;
margin: 10px;
}
input {
position: relative;
z-index: 100;
}
.border {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
<div class="container">
<input class="btn-radio" type="radio" value="123" name="rd" />Input 1
<div class="border"></div>
</div>
<div class="container">
<input class="btn-radio" type="radio" value="1234" name="rd" />Input 2
<div class="border"></div>
</div>
<div class="container">
<input class="btn-radio" type="radio" value="12345" name="rd" /> Input 3
<div class="border"></div>
</div>
Here is a solution without new elements, you can use the ::before of the input to make the border on the container. Good Luck!
.container {
position: relative;
margin-bottom: 2em;
}
input[type="radio"]:checked::before {
content: '';
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
border: 5px solid red;
}
<div class="container">
<p>container 123</p>
<input class="btn-radio" type="radio" value="123" name="rd" />
</div>
<div class="container">
<p>container 1234</p>
<input class="btn-radio" type="radio" value="1234" name="rd" />
</div>
<div class="container">
<p>container 12345</p>
<input class="btn-radio" type="radio" value="12345" name="rd" />
</div>
Use id insted of that. Give them individual id.
#id:checked + .container {
border: 5px solid red;;
}
For better result use the id for container as well.

How to set div cell to act like th?

Hello everyone I have form which contains few different group of fields. In order to keep them together I used div elements and make them act like table elements. I used this method to avoid table elements inside of the form. In other hand some people said this approach is the same basically since I made div's to act like a table. To be honest I'm not sure if this is the best option. Here is example of my code.
form {
width: 820px;
}
form.frmLayout fieldset {
border: #ccc 2px solid;
margin: 10px;
border-radius:3px;
}
form.frmLayout legend {
font-weight: bold;
background-color: #c8e2db;
border-radius:3px;
padding: 3px;
border: #ccc 2px solid;
}
form.frmLayout label {
float: left;
font-weight: bold;
display: block;
}
form.frmLayout input[type=text] {
text-align: left;
background-color: #c8e2db;
}
div.formItem {
margin-top: 5px;
margin-bottom: 5px;
margin-left: 5px;
margin-right: 5px;
padding-top: 5px;
padding-bottom: 5px;
background-repeat: repeat-x;
clear: both;
border-bottom: #ccc 2px dashed;
}
div.formItem:last-child{
border-bottom: none;
}
div.formTbl {
display: table;
width: 100%;
}
div.frRow {
display: table-row;
text-align: left;
}
div.frCell {
display: table-cell;
padding-top: 2px;
padding-bottom: 2px;
padding-left: 0px;
padding-right: 0px;
text-align: center;
}
div.frCell span {
font-weight: bold;
}
<form name="myForm" id="myForm" method="POST" action="#" class="frmLayout">
<input type="hidden" name="frmhs_id" id="frmhs_id" value="" />
<fieldset>
<legend>My Form</legend>
<div class="formItem">
<div class="formTbl">
<div class="frRow">
<div class="frCell" style="width:60%;">
</div>
<div class="frCell" style="width:40%;">
<div class="formTbl">
<div class="frRow">
<div class="frCell" style="width:40%;">
<span>Acoustic Reflex Thresholds</span>
</div>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<span>500</span>
</div>
<div class="frCell" style="width:10%;">
<span>1000</span>
</div>
<div class="frCell" style="width:10%;">
<span>2000</span>
</div>
<div class="frCell" style="width:10%;">
<span>4000</span>
</div>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td6" id="frmhs_td6" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td7" id="frmhs_td7" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td8" id="frmhs_td8" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td9" id="frmhs_td9" value="" size="4" maxlength="4" />
</div>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td15" id="frmhs_td15" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td16" id="frmhs_td16" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td17" id="frmhs_td17" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td18" id="frmhs_td18" value="" size="4" maxlength="4" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="formItem">
<div style="float:left;">
<span><input type="submit" name="frmSubmit" id="frmhdSubmit" value="Submit"></span>
</div>
<div style="float:right;">
<span id="MsgFrm"></span>
</div>
</div>
</fieldset>
</form>
As you can see in my example above title Acoustic Reflex Thresholds is not on the center. Also I think that affects first set of div cells to change the width. I'm wondering how I can make title to go over entire length of div cell? If anyone knows how this can be fixed or is there better way to do this please let me know. Thanks in advance.
One of the limitations of css table layout is that you cannot simulate colspan, so the cells are going to be sized the same as the rest in its "column" even if its only 1 column in the row (as you can see with your "Acoustic Reflex Thresholds" heading).
What you can do is make the heading a table-caption instead of a row and that works, as you can see if you run the updated code snippet below.
There are 2 changes required:
CSS: Add the new class for the table caption
div.frCaption{
display: table-caption;
caption-side: top;
text-align: center;
font-weight: bold;
}
HTML: change the table-row to table-caption
In the row that contains with you "Acoustic Reflex Thresholds" heading:
Change the class from frRow to frCaption
Remove the frCell div altogether
[...right column...]
<div class="frCell" style="width:40%;">
<div class="formTbl">
<div class="frCaption ">
<span>Acoustic Reflex Thresholds</span>
</div>
<div class="frRow">
[... rest of rows...]
form {
width: 820px;
}
form.frmLayout fieldset {
border: #ccc 2px solid;
margin: 10px;
border-radius:3px;
}
form.frmLayout legend {
font-weight: bold;
background-color: #c8e2db;
border-radius:3px;
padding: 3px;
border: #ccc 2px solid;
}
form.frmLayout label {
float: left;
font-weight: bold;
display: block;
}
form.frmLayout input[type=text] {
text-align: left;
background-color: #c8e2db;
}
div.formItem {
margin-top: 5px;
margin-bottom: 5px;
margin-left: 5px;
margin-right: 5px;
padding-top: 5px;
padding-bottom: 5px;
background-repeat: repeat-x;
clear: both;
border-bottom: #ccc 2px dashed;
}
div.formItem:last-child{
border-bottom: none;
}
div.formTbl {
display: table;
width: 100%;
}
div.frRow {
display: table-row;
text-align: left;
}
div.frCell {
display: table-cell;
padding-top: 2px;
padding-bottom: 2px;
padding-left: 0px;
padding-right: 0px;
text-align: center;
}
div.frCell span {
font-weight: bold;
}
div.frCaption{
display: table-caption;
caption-side: top;
text-align: center;
font-weight: bold;
}
<form name="myForm" id="myForm" method="POST" action="#" class="frmLayout">
<input type="hidden" name="frmhs_id" id="frmhs_id" value="" />
<fieldset>
<legend>My Form</legend>
<div class="formItem">
<div class="formTbl">
<div class="frRow">
<div class="frCell" style="width:60%;">
</div>
<div class="frCell" style="width:40%;">
<div class="formTbl">
<div class="frCaption ">
<span>Acoustic Reflex Thresholds</span>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<span>500</span>
</div>
<div class="frCell" style="width:10%;">
<span>1000</span>
</div>
<div class="frCell" style="width:10%;">
<span>2000</span>
</div>
<div class="frCell" style="width:10%;">
<span>4000</span>
</div>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td6" id="frmhs_td6" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td7" id="frmhs_td7" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td8" id="frmhs_td8" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td9" id="frmhs_td9" value="" size="4" maxlength="4" />
</div>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td15" id="frmhs_td15" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td16" id="frmhs_td16" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td17" id="frmhs_td17" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td18" id="frmhs_td18" value="" size="4" maxlength="4" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="formItem">
<div style="float:left;">
<span><input type="submit" name="frmSubmit" id="frmhdSubmit" value="Submit"></span>
</div>
<div style="float:right;">
<span id="MsgFrm"></span>
</div>
</div>
</fieldset>
</form>

how to design a tree with css without using (:before, :last-child and Jquery) [duplicate]

This question already has an answer here:
Vertical Tree with CSS and HTML
(1 answer)
Closed 6 years ago.
How can I design a tree without using (:before, :last-child and :after) because they are not supported in my project (I am using IE7). The problem is that the left border of the list does not stop at the last item.
Example of the problem:
error
The solution should look like:
ok
Here is a fragment of my jsp code:
<s:if test="testDev == ''">
<s:if test="reponseDTO.testDevItemDTOMap.size > 0">
<div class="misc_pad" style="position:relative">
<p class="p_spacer"><b>Dev</b></p>
<s:iterator value="reponseDTO.testDevItemDTOMap" status="testDevStatus">
<div class="menu_test">
<div>
<a href="expandtestDev_<s:property value="#testDevStatus.index" />" rel="expandtest">
<s:if test="reponseDTO.testDevNiveau2ItemDTOMap.get(key).size > 0"><img id="expandTree" src="<portal-logic:urlFindInTheme file="images/sdin/layout/open_content.gif" />" />
</s:if>
</a>
<a href="<s:property value="value.valeurP" />" rel="testDev" class="menu_test_lien">
<s:property value="value.libelle" /> (<s:property value="value.nombreDocuments" />)</a>
</div>
<s:if test="reponseDTO.testDevNiveau2ItemDTOMap.get(key).size > 0">
<ul id="expandtestDev_<s:property value="#testDevStatus.index" />">
<s:iterator value="reponseDTO.testDevNiveau2ItemDTOMap.get(key)" status="testDevNiveau2Status">
<li>
<div class="menu_test">
<div>
<a href="expandtestDevNiveau2_<s:property value="#testDevStatus.index" />_<s:property value="#testDevNiveau2Status.index" />" rel="expandtest">
<s:if test="reponseDTO.testDevNiveau3ItemDTOMap.get(valeurP).size > 0">
<img id="expandTree" src="<portal-logic:urlFindInTheme file="images/sdin/layout/open_content.gif" />" />
</s:if>
</a>
<a href="<s:property value="valeurP" />" rel="testDev" class="menu_test_lien">
<s:property value="libelle" /> (<s:property value="nombreDocuments" />)
</a>
</div>
<s:if test="reponseDTO.testDevNiveau3ItemDTOMap.get(valeurP).size > 0">
<ul id="expandtestDevNiveau2_<s:property value="#testDevStatus.index" />_<s:property value="#testDevNiveau2Status.index" />">
<s:iterator value="reponseDTO.testDevNiveau3ItemDTOMap.get(valeurP)" status="testDevNiveau3Status">
<li>
<s:property value="libelle" /> (<s:property value="nombreDocuments" />)
</li>
</s:iterator>
</ul>
</s:if>
</div>
</li>
</s:iterator>
</ul>
</s:if>
</div>
</s:iterator>
</div>
</s:if>
</s:if>
I found this piece of code that looks like what I want:
.test ul {
padding:0;
margin: 0;
margin-left:6px;
list-style:none;
background: #fff;
color:#000;
position:relative;
}
.test ul:before {
content:"";
position:absolute;
top:0;
bottom:0;
left:0;
border-left:1px solid #000;
}
.test li {
margin:0;
padding:0 16px;
line-height:2em;
font-weight:bold;
position:relative;
}
.test li:before {
content:"";
display:block;
width:10px;
height:0;
border-top:1px solid #000;
margin-top:-1px;
position:absolute;
top:1em;
left:0;
}
.test li:last-child:before {
background:white;
height:auto;
top:1em;
bottom:0;
}
<html>
<head>
<link rel="stylesheet" href="test.css">
</head>
<body>
<div class="test">
<div>
+
Label A
</div>
<ul>
<li>
<div class="test">
<div>
+
Label A1
</div>
<ul>
<li>
<div class="test">
<div>
+
Label A11
</div>
</div>
</li>
<li>
<div class="test">
<div>
+
Label A12
</div>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</body>
</html>
Any help will be appreciated.
I have made it using flex box refer the snippet below. Hope you are looking something like this
.outerBdr{
border-left:1px solid #dfdfdf;
position:relative;
display:flex;
flex-flow: column wrap;
align-items:flex-start;
justify-content:space-between;
overflow:auto
}
.cenBdr{
position:relative;
padding-left:30px;
display:flex;
align-items:center;
margin-bottom:10px
}
.cenBdr label,.cenBdrInr label{
position:relative;
margin-right:5px;
align-self:flex-start
}
.cenBdr label:before, .cenBdrInr label:before{
content: '';
position: absolute;
left: -51px;
width: 33px;
height: 1px;
border-top: 1px solid #dfdfdf;
top: 50%;
}
.cenBdrInr label:before{
width:30px;
left:-48px
}
.cenBdrInr{
align-items: flex-start;
display: flex;
flex-flow: column nowrap;
justify-content: space-around;
padding-left: 30px;
border-left: 1px solid #dfdfdf;
position:relative
}
.cenBdrInr > div{
margin-bottom:10px;
display:flex
}
.cenBdr input{
align-self:flex-start;
}
<div class="outerBdr">
<div class="cenBdr">
<input type="checkbox" id="name">
<label for="name">Name</label>
</div>
<div class="cenBdr">
<input type="checkbox" id="mark">
<label for="mark">Marks</label>
<div class="cenBdrInr">
<div>
<input type="checkbox" id="subj1">
<label for="sub1">Subj1</label>
<div class="cenBdrInr">
<div>
<input type="checkbox" id="subj1">
<label for="sub1">Subj1</label>
</div>
<div>
<input type="checkbox" id="subj2">
<label for="subj2">subj2</label>
</div>
<div>
<input type="checkbox" id="subj3">
<label for="subj3">subj3</label>
<div class="cenBdrInr">
<div>
<input type="checkbox" id="subj1">
<label for="sub1">Subj1</label>
</div>
<div>
<input type="checkbox" id="subj2">
<label for="subj2">subj2</label>
</div>
</div>
</div>
</div>
</div>
<div>
<input type="checkbox" id="subj2">
<label for="subj2">subj2</label>
</div>
<div>
<input type="checkbox" id="subj3">
<label for="subj3">subj3</label>
</div>
</div>
</div>
<div class="cenBdr">
<input type="checkbox" id="id">
<label for="id"> ID</label>
</div>
<div class="cenBdr">
<input type="checkbox" id="rank">
<label for="rank"> Rank</label>
</div>
<div class="cenBdr">
<input type="checkbox" id="rating">
<label for="rating"> rating</label>
<div class="cenBdrInr">
<div>
<input type="checkbox" id="subj1">
<label for="sub1">Subj1</label>
<div class="cenBdrInr">
<div>
<input type="checkbox" id="subj1">
<label for="sub1">Subj1</label>
</div>
<div>
<input type="checkbox" id="subj2">
<label for="subj2">subj2</label>
</div>
<div>
<input type="checkbox" id="subj3">
<label for="subj3">subj3</label>
<div class="cenBdrInr">
<div>
<input type="checkbox" id="subj1">
<label for="sub1">Subj1</label>
</div>
<div>
<input type="checkbox" id="subj2">
<label for="subj2">subj2</label>
</div>
</div>
</div>
</div>
</div>
<div>
<input type="checkbox" id="subj2">
<label for="subj2">subj2</label>
</div>
<div>
<input type="checkbox" id="subj3">
<label for="subj3">subj3</label>
</div>
</div>
</div>
<div class="cenBdr">
<input type="checkbox" id="class">
<label for="class"> class</label>
</div>
</div>

layout with twitter-bootstrap form

I have difficulties to arrange the css bootstrap form .
On top of the picture below is the layout I get and just under is the layout I would like to obtain:
http://s27.postimg.org/dfztgn35v/flow_Root3665.png
This is: the first column witn names aligned on their last letter, and aligned input fields on the left and on the right.
Here is the css I used:
<div class="well">
<form class="form-horizontal" method="post">
<fieldset>
<legend>Event</legend>
<div class="form-group">
<label for="input-append date" class="col-lg-1 control-label">Date</label>
<div class="col-lg-3">
<div class="input-group input-append date" id="startDatePicker">
<input type="text" class="form-control" name="datepicker" id="datepicker1" readonly style="background-color: white" /><span class="input-group-addon add-on"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
</div>
<div class="form-group">
<label for="input-append type" class="col-lg-1 control-label">Type</label>
<div class="col-lg-2">
<select class="form-control" id="select">
<option>select1</option>
<option>select2</option>
</select>
</div>
</div>
<div class="form-group">
<label for="inputTitle" class="col-lg-1 control-label">Title</label>
<div class="col-lg-6">
<input kl_virtual_keyboard_secure_input="on" class="form-control" id="inputTitle" placeholder="Title" type="text" maxlength="30">
</div>
</div>
<div class="form-group">
<label for="textArea" class="col-lg-1 control-label">Description</label>
<div class="col-lg-6">
<textarea class="form-control" rows="3" id="textArea" placeholder="Description" maxlength="200"></textarea>
</div>
</div>
</div>
</fieldset>
</form>
</div>
Thanks!
With some minor CSS you can acheive that. See example.
#soForm input,
#soForm select {
height: 50px;
font-size: 16px;
-webkit-border-radius: 0;
border-radius: 0;
border: 4px solid #444;
}
#soForm textarea {
font-size: 16px;
-webkit-border-radius: 0;
border-radius: 0;
border: 4px solid #444;
}
#soForm .input-group-addon {
height: 50px;
font-size: 13px;
-webkit-border-radius: 0;
border-radius: 0;
border-right: 4px solid #444;
border-top: 4px solid #444;
border-bottom: 4px solid #444;
}
.btn.btn-submit {
border-radius: 0;
height: 50px;
width: 100px;
border: 4px solid #444;
}
#media (min-width: 768px) {
#soForm .soForm {
margin: 10px auto;
}
#soForm .control-label {
margin-top: 25px;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="well">
<div class="container">
<form id="soForm" name="soForm">
<div class="form-group">
<label for="date" class="col-sm-2 control-label">Date</label>
<div class="col-sm-5">
<div class="input-group soForm">
<input type="text" class="form-control" id="date" /> <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
</div>
</div>
</div>
<div class="form-group">
<label for="type" class="col-sm-2 control-label">Type</label>
<div class="col-sm-3">
<select class="form-control soForm" id="type">
<option>select1</option>
<option>select2</option>
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label">Title</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="title" />
</div>
</div>
<div class="form-group">
<label for="description" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<textarea class="form-control soForm" rows="5" id="desc"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default btn-submit">Submit</button>
</div>
</div>
</form>
</div>
</div>

Resources