Hey guys, today in this post we are going to learn about How to make custom radio buttons animated with delay cool effect on mouse hover in pure css without JQuery/Javascript in HTML.
Radio buttons are normally presented in radio groups (a collection of radio buttons describing a set of related options). Only one radio button in a group can be selected at the same time.
Note: The radio group must have share the same name (the value of the name attribute) to be treated as a group. Once the radio group is created, selecting any radio button in that group automatically deselects any other selected radio button in the same group. You can have as many radio groups on a page as you want, as long as each group has its own name. To Know more details about radio buttons, Click Here..
Final Output β
You can download file directly from github by Click Here.
Other related post that would you like to learn in Salesforce
- Find the below steps βΎ
Create HTML File β
Step 1:- Create HTML File : radioButtonTickMarkCSS.html
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Radio button with tick mark css</title>
<STYLE TYPE="text/css">
.radioOver ul{
padding: 0;
overflow: auto;
list-style: none;
margin: 0;
}
.radioOver ul li{
position: relative;
float: left;
width: 100%;
height: 100px;
color: #ccc;
display: block;
}
.radioOver ul li input[type=radio]{
position: absolute;
visibility: hidden;
}
.radioOver ul li label{
font-size: 25px;
padding: 25px 25px 25px 80px;
margin: 10px auto;
height: 30px;
z-index: 9;
display: block;
position: relative;
font-weight: 300;
cursor: pointer;
-webkit-transition: all 0.25s linear;
}
.radioOver ul li:hover label{
color: #000;
}
.radioOver ul li .check{
border-radius: 100%;
height: 25px;
width: 25px;
top: 30px;
left: 20px;
z-index: 5;
display: block;
position: absolute;
border: 5px solid #000;
transition: border .25s linear;
-webkit-transition: border .25s linear;
}
.radioOver ul li:hover .check {
border: 5px solid #ff8000;
}
.radioOver ul li .check::before {
border-radius: 100%;
height: 15px;
width: 15px;
top: 5px;
left: 5px;
display: block;
position: absolute;
content: '';
margin: auto;
transition: background 0.25s linear;
-webkit-transition: background 0.25s linear;
}
.radioOver input[type=radio]:checked ~ .check {
border: 5px solid #00ff00;
}
.radioOver input[type=radio]:checked ~ .check::before{
background: #ff00ff;
}
.radioOver input[type=radio]:checked ~ label{
color: #ff00ff;
}
</STYLE>
</head>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="10" bordercolor="#ddd" style="border-collapse:collapse; font-family:Arial, Helvetica, sans-serif;"">
<caption>
<h2 style="color:#ff8000; font-family:Arial, Helvetica, sans-serif;">Radio button with tick mark css animation</h2>
</caption>
<tr>
<td style="width:50%; vertical-align:top;">
<div class="radioOver">
<ul>
<li>
<input type="radio" id="SalesforceLWC" name="selector">
<label for="SalesforceLWC">Salesforce LWC</label>
<div class="check"></div>
</li>
<li>
<input type="radio" id="AuraComponent" name="selector">
<label for="AuraComponent">Aura Component</label>
<div class="check"><div class="inside"></div></div>
</li>
<li>
<input type="radio" id="Visualforce" name="selector">
<label for="Visualforce">Visualforce</label>
<div class="check"><div class="inside"></div></div>
</li>
</ul>
</div>
</td>
<td style="width:50%; vertical-align:top;">
<div class="radioOver">
<ul>
<li>
<input type="radio" id="SalesforceTutorial" name="selector">
<label for="SalesforceTutorial">Salesforce Tutorial W3web.net</label>
<div class="check"></div>
</li>
<li>
<input type="radio" id="SalesforceIntegration" name="selector">
<label for="SalesforceIntegration">Salesforce Integration</label>
<div class="check"><div class="inside"></div></div>
</li>
<li>
<input type="radio" id="SalesforceTrigger" name="selector">
<label for="SalesforceTrigger">Salesforce Trigger</label>
<div class="check"><div class="inside"></div></div>
</li>
</ul>
</div>
</td>
</tr>
</table>
<br/><br/>
<!--Start RelatedTopics Section-->
<div style="border:1px #ddd solid; padding:10px; background:#eee; margin:40px 0; overflow:hidden; clear:both;">
<p data-aura-rendered-by="435:0"><img src="https://www.w3web.net/wp-content/uploads/2021/05/thumbsUpLike.png" width="25" height="25" style="vertical-align:top; margin-right:10px;" data-aura-rendered-by="436:0"><strong data-aura-rendered-by="437:0"><span style="font-size:16px; font-style:italic; display:inline-block; margin-right:5px;">Don't forget to check out:-</span><a href="https://www.w3web.net/" target="_blank" rel="noopener noreferrer" style="text-decoration:none;" data-aura-rendered-by="440:0">An easy way to learn step-by-step online free Salesforce tutorial, To know more Click <span style="color:#ff8000; font-size:18px;" data-aura-rendered-by="442:0">Here..</span></a></strong></p>
<br/><br/>
<p data-aura-rendered-by="435:0"><img src="https://www.w3web.net/wp-content/uploads/2021/07/tickMarkIcon.png" width="25" height="25" style="vertical-align:top; margin-right:10px;" data-aura-rendered-by="436:0"><strong data-aura-rendered-by="437:0"><span style="font-size:17px; font-style:italic; display:inline-block; margin-right:5px; color:rgb(255 128 0);">You May Also Like β</span> </strong></p>
<div style="display:block; overflow:hidden;">
<div style="width: 50%; float:left; display:inline-block">
<ul style="list-style-type: square; font-size: 16px; margin: 0 0 0 54px; padding: 0;">
<li><a href="https://www.w3web.net/lwc-get-set-lightning-checkbox-value/" target="_blank" rel="noopener noreferrer">How to get selected checkbox value in lwc</a></li>
<li><a href="https://www.w3web.net/display-account-related-contacts-in-lwc/" target="_blank" rel="noopener noreferrer">how to display account related contacts based on AccountId in lwc</a></li>
<li><a href="https://www.w3web.net/create-lightning-datatable-row-actions-in-lwc/" target="_blank" rel="noopener noreferrer">how to create lightning datatable row actions in lwc</a></li>
<li><a href="https://www.w3web.net/if-and-else-condition-in-lwc/" target="_blank" rel="noopener noreferrer">how to use if and else condition in lwc</a></li>
<li><a href="https://www.w3web.net/get-selected-radio-button-value-and-checked-default-in-lwc/" target="_blank" rel="noopener noreferrer">how to display selected radio button value in lwc</a></li>
</ul>
</div>
<div style="width: 50%; float:left; display:inline-block">
<ul style="list-style-type: square; font-size: 16px; margin: 0 0 0 54px; padding: 0;">
<li><a href="https://www.w3web.net/display-account-related-contacts-lwc/" target="_blank" rel="noopener noreferrer">display account related contacts based on account name in lwc</a></li>
<li><a href="https://www.w3web.net/create-lightning-datatable-row-actions-in-lwc/" target="_blank" rel="noopener noreferrer">how to insert a record of account Using apex class in LWC</a></li>
<li><a href="https://www.w3web.net/fetch-picklist-values-dynamic-in-lwc/" target="_blank" rel="noopener noreferrer">how to get picklist values dynamically in lwc</a></li>
<li><a href="https://www.w3web.net/edit-save-and-remove-rows-dynamically-in-lightning-component/" target="_blank" rel="noopener noreferrer">how to edit/save row dynamically in lightning component</a></li>
<li><a href="https://www.w3web.net/update-parent-object-from-child/" target="_blank" rel="noopener noreferrer">update parent field from child using apex trigger</a></li>
</ul>
</div>
<div style="clear:both;"></div>
<br/>
<div class="youtubeIcon">
<a href="https://www.youtube.com/channel/UCW62gTen2zniILj9xE6LmOg" target="_blank" rel="noopener noreferrer"><img src="https://www.w3web.net/wp-content/uploads/2021/11/youtubeIcon.png" width="25" height="25" style="vertical-align:top; margin-right:10px;"/> <strong>TechW3web:-</strong> To know more, Use this <span style="color: #ff8000; font-weight: bold;">Link</span> </a>
</div>
</div>
</div>
<!--End RelatedTopics Section-->
</body>
</html>
Further post that would you like to learn in Salesforce
How do you style radio buttons as buttons?
The way to do it is to use 'label' elements with properly set for attributes, then hide the radio button itself using visibility: hidden rather than display: none . You can then position the labels wherever you want and they will act as radio buttons.
Can you style an HTML radio button to look like a checkbox?
Yes it can be done using this css, i've hidden the default radio button and made a custom radio button that looks like a checkbox.
What does a radio button look like?
A radio button should be a small circle that has a solid circle inside it when selected. Visually present groups of choices as groups, and clearly separate them from other groups on the same page.
Related Topics | You May Also Like
Our Free Courses β
π Get Free Course β
π Salesforce Administrators π Salesforce Lightning Flow Builder π Salesforce Record Trigger Flow Builder |
π Get Free Course β
π Aura Lightning Framework π Lightning Web Component (LWC) π Rest APIs Integration |