0

I'm using label And class of switch but can't add css property to check box so that i can create switch even span in not working.

.switch {
  position: relative;
  display: inline - block;
  width: 60 px;
  height: 34 px;
  background: #999
}
<label class="switch"><input type="checkbox"><span class="slider round"></span></label>
Alexandre Elshobokshy
  • 10,720
  • 6
  • 27
  • 57

3 Answers3

0

The question is unclear, but as far as I understood, you are trying to give some styles to your elements, and it seems that your style doesn't apply on your checkbox.

Anyways, your style is working fine, I've just added a background property to show you that your styles have been applied without any problems.

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
  background: #999
}
<label class="switch">
  <input type="checkbox">
  <span class="slider round">foo</span>
 </label>

If you are trying to give custom styles to your checkbox, read the answers to this question

Welcome to the StackOverflow community, and the more specific your question can be, you will get better, to the point answers... Good Luck!

Elharony
  • 886
  • 8
  • 18
0

css is identifying input like below

input[type='checkbox']:checked{
   //if checked then property
}
raviramani
  • 522
  • 2
  • 14
0

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
  background: #000000;
  }
<label class="switch"><input type="checkbox"><span class="slider round"></span></label>

Please check above code I have tried that it's working

Arshiya Khanam
  • 613
  • 6
  • 12
  • 2
    Am I the only one who wonders how this is the right answer, since it doesn't change anything from the original. – Mr Lister Oct 03 '18 at 09:29