Style setting button

Here is my web page

I am trying to make big switches with no luck.

This is a custom WP plugin and the owner does not support users for such questions. I tried to follow many tutorials like one , but the structure of the code is usually different:

My code

<li class="wpProQuiz_questionListItem" data-pos="1">
   <span style="display:none;">1. </span>
   <label>
      <input class="wpProQuiz_questionInput" type="radio" name="question_1" value="323"/>
      Answer 1
   </label>
</li>

      

and in the tutorial the code is presented as

<td>
  <input type="radio" name="radiog_dark" id="radio1" class="css-checkbox" />
  <label for="radio1" class="css-label radGroup2">Option 1</label>
</td>

      

Can anyone help me?

Riccardo

+3


source to share


2 answers


HTML markup:

<ul>
    <li>
        <label>
            <input class="wpProQuiz_questionInput" type="radio" name="question_1_2" value="3" />
            <span class="graphical-radio"></span>
            Non riesco a lasciarlo solo
        </label>
    </li>
</ul>

      

CSS:



input[type="radio"] {
    display: none;
}

.graphical-radio {
    background: gray;
    display: inline-block;
    width: 30px;
    height: 30px;
    border-radius: 100%;
}

input[type="radio"]:checked + .graphical-radio {
    background: red;
}

      

Magic with a selector :checked

, so you can style graphical-radio

as you see fit.

jsFiddle Demo .

+5


source


An element style element is nearly impossible to make cross-browser. I would choose a custom element that reflects the state of the hidden checkbox using javascript.



0


source







All Articles