Styling HTML Radio Buttons as Checkboxes
Problem:
Users require printed forms to resemble official government documents, including radio buttons designed as square checkboxes. Despite the on-screen display of radio buttons, the printed version must reflect the checkbox style.
Solution:
Modern browsers like Firefox 1 , Chrome 1 , Safari 3 , and Opera 15 support the appearance property, which enables styling radio buttons to mimic checkboxes. Here's how to achieve this:
input[type="radio"] { appearance: checkbox; }
This code applies the checkbox appearance to all radio buttons. The result in supported browsers will be:
<label><input type="radio" name="radio"> Checkbox 1</label> <label><input type="radio" name="radio"> Checkbox 2</label>
Using the appearance property, it is possible to style radio buttons as checkboxes while avoiding the complexity of creating and synchronizing shadow checkboxes using JavaScript and CSS.
The above is the detailed content of How Can I Style HTML Radio Buttons to Look Like Checkboxes on Print?. For more information, please follow other related articles on the PHP Chinese website!