Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Border for checkbox

I am applying a style for a checkbox from jQuery

$("#reg_checkbox").css("border","thin solid red");

The border works fine in IE but not in mozilla , how can I make it browser compatible ?

like image 475
manu Avatar asked Jan 05 '11 04:01

manu


People also ask

How do you put a border on a checkbox?

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. Then, specify the border-radius, transition, position, and other properties.

How do I style a checkbox in CSS?

The checkbox is an HTML element used to take input from the user. It is hard to style the checkbox, but pseudo-elements makes it easier to style a checkbox. This HTML element is generally used on every website, but without styling them, they look similar on every website.

How do you give a border-radius to a checkbox?

cursor: pointer; position: absolute; width: 20px; height: 20px; top: 0; border-radius: 10px; The last line (border-radius: 10px) will give you a checkbox with rounded corners.

How do I change the color of a checkbox in CSS?

“:hover” is used to style the checkbox when user hovers over it. Notice that when the mouse pointer move over the checkbox the color of it changes to yellow. “:active” is used to style the checkbox when it is active. Notice that when click the checkbox it will first notice a red color and then the green color.


1 Answers

Use Outline: http://jsfiddle.net/Kqcx7/1/

$('#reg_checkbox').css('outline-color', 'red');
$('#reg_checkbox').css('outline-style', 'solid');
$('#reg_checkbox').css('outline-width', 'thin');
like image 167
Eric Fortis Avatar answered Sep 24 '22 05:09

Eric Fortis