-1

get a minus "-" symbol inside checkbox using html and css only

I tried using

document.getElementsByTagName("input")[0].indeterminate = true;

but requirement is using html and css only

Priya
  • 1,313
  • 6
  • 19
  • 38
Rohith Sai
  • 21
  • 1

1 Answers1

1

It sounds like you want a label posing like a checkbox, with a minus symbol inside. Like this:

<div>
<input type="checkbox" id="box">
<label for="box">-</label>
</div>

<style>
    input{
      display:none
    }
    label{
      padding:0 6px;
      border:1px solid #eee
    }
    input:checked + label {
     background:#000;
     color:#fff
    }
</style>

JSFIDDLE

Handsken
  • 639
  • 9
  • 26