1.html
<div> <input type="checkbox" id="option"/> <label for="option"> <span></span> 点击1 </label></div><div> <input type="radio" name="my-radio" id="radio-option-1"/> <label for="radio-option-1"> <span></span> 点击2 </label></div><div> <input type="radio" name="my-radio" id="radio-option-2"/> <label for="radio-option-2"> <span></span> 点击3</label></div> 2.cssbody { font-family: "Verdana", sans-serif; background-color: #eee; padding: 50px; font-size: 30px;}div { margin-bottom: 1em;}input[type="checkbox"], input[type="radio"] { display: none;}label { cursor:pointer; color: #555;}input[type="checkbox"]:checked + label,input[type="radio"]:checked + label { color: deepPink;}input[type="checkbox"] + label span,input[type="radio"] + label span { display: inline-block; vertical-align: middle; width: 45px; height: 45px; border: 2px solid #888; border-radius: 10px; background: radial-gradient(#eee, #aaa);} input[type="checkbox"] + label span:hover,input[type="radio"] + label span:hover{ box-shadow: 0px 0px 10px #000;}input[type="checkbox"]:checked + label span:hover,input[type="radio"]:checked + label span:hover{ border: 2px solid #c3ff65;} input[type="radio"] + label span { border-radius: 50%;}input[type="checkbox"] + label span::before { content: ""; display: block;} input[type="checkbox"]:checked + label span::before { content: "?"; color: deepPink; text-align: center; font-size: 40px;}input[type="radio"]:checked + label span { background-image: radial-gradient(#FF5ABA, deepPink);}
时间: 2024-10-21 04:05:05