I am trying to remove the actual box of a checkbox field, and just make the text clickable. How can I do this with JS and css? I started using buttons, but I switched to checkboxes because the "state" of the box is easier to find out than a button. But now that I am polishing up the page with css for better formatting and layout, The boxes are getting in the way, and I would prefer just for the text to be clickable without a box present.
You can remove that by unselecting the "highlight existing form fields" function at the top of your document. If you are talking about the actual outline of the "box" part of a checkbox, you can bring up the field properties, then go to the Appearance tab and set both border color and fill color to transparent.
Use the :checked pseudo-class, which helps to see when the checkbox is checked. Style the label with the width, height, background, margin, and border-radius properties. Set the position to "relative". Style the "checkbox-example" class by setting the display to "block" and specifying the width and height properties.
In short, you can't. How a checkbox is rendered is dependent on browser and (if the browser allows it - and most don't) OS settings. The only option you have is to hide the checkbox and use separate, style-able elements to display "it" the way you want.
To change size, color, or border style of the check box, select the Use a style to format text typed into the empty control box, and then click New Style. Under Formatting, select a font size for the check box. In the Color list, select a color. To select a different border, select Format > Border.
You can just hide it with CSS using display: none;
HTML
<input type="checkbox" name="a" id="a" value="a" /><label for="a">asdf</label>
CSS
/* for all inputs of type checkbox */
input[type="checkbox"] {
display: none;
}
/* for just the single element by id */
#a {
display: none;
/* visibility: hidden works too */
}
See here for difference between visibility:hidden
and display:none
.
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With