At present the design is an important part of web programming. So we have to design properly. We often work with form. Some time we use radio in our web form. In general radio look like as below
But we want to make it different from above. So we have to design it with CSS(Cascading Style Sheet).
First of all we write a basic radio in HTML.
For any question on this topics please write your question/comment on comment area below.
But we want to make it different from above. So we have to design it with CSS(Cascading Style Sheet).
First of all we write a basic radio in HTML.
<div class="design">Now we will design it with CSS . First we hide radio inputs and design its label properly.
<input type="radio" name="d1" id="radio11">
<label for="radio11">Radio11</label>
<input type="radio" name="d1" id="radio12">
<label for="radio12">Radio12</label>
</div>
.design1 input[type='radio']{After write the above css the radio button look like below.
display: none
}
.design1 label{
display: inline-block;
cursor: pointer;
position: relative;
padding-left:20px;
margin-right: 10px;
font-size: 100%;
}
Now we will fixed the box before label. It well be as below css code.
.design1 label:before{After write the above code the radio button look like as below.
content: "";
height: 15px;
width: 15px;
border: 1px solid #999;
margin-right: 10px;
display: inline-block;
position: absolute;
left: 0;
}
.design1 label:before{
border-radius: 4px;
}
Now I will write what we wand show after clicking/checking the radio button. The code for checked radio button as
.design1 input[type='radio']:checked+label:before{After finishing our design for radio button the radio button group look like as below image.
content: '\2713';
line-height: 18px;
text-shadow: 0 0px 1px #797979;
}
For any question on this topics please write your question/comment on comment area below.
Have you tried em, instead of px....so it is a little bit fluid for different browser settings..
ReplyDelete