How to style a checkbox using CSS

0 votes
I am trying to style a checkbox using the following:

<input type="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;" />

But the style is not applied. The checkbox still displays its default style. How do I give it the specified style?
Jun 20, 2022 in CSS by Edureka
• 13,620 points
354 views

1 answer to this question.

0 votes
  1. Add focus outline input[type="checkbox"]:focus + span:before { outline: 1px dotted #aaa; } ...
  2. Set gray color for disabled checkbox input[type="checkbox"]:disabled + span { color: #999; }
  3. Set hover shadow on non-disabled checkbox input[type="checkbox"]:not(:disabled) + span:hover:before { text-shadow: 0 1px 2px #77F; }
answered Jun 21, 2022 by Edureka
• 12,690 points

Related Questions In CSS

0 votes
0 answers

How to make a back-to-top button using CSS and HTML only?

I want to scroll down and up ...READ MORE

Jun 30, 2022 in CSS by Edureka
• 13,620 points
325 views
0 votes
0 answers

How to make a transparent border using CSS?

Ideally, the border should be translucent. That ...READ MORE

Jul 4, 2022 in CSS by Edureka
• 13,620 points
410 views
0 votes
0 answers

How to draw a checkmark / tick using CSS?

How do I create a tick using ...READ MORE

Jul 22, 2022 in CSS by Edureka
• 13,620 points
1,269 views
0 votes
1 answer

How to build a special polygon (a kite shape) with HTML & CSS only?

I made two divs, one for Arc ...READ MORE

answered May 28, 2022 in CSS by Edureka
• 12,690 points
1,143 views
0 votes
1 answer

How to style a checkbox using CSS

In modern browsers which include Internet Explorer ...READ MORE

answered Feb 17, 2022 in Others by Aditya
• 7,680 points
670 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
9,657 views
0 votes
1 answer

Using/Handling colon inside a JSF generated HTML element ID in CSS selector

Yes, you can.  Just Backslash (\) the colon.  Like ...READ MORE

answered Nov 14, 2018 in Others by DataKing99
• 8,240 points
2,564 views
0 votes
1 answer

What is a css selector and where is it used?

CSS Selector is a combination of element ...READ MORE

answered Nov 21, 2018 in Data Analytics by Kalgi
• 52,360 points
694 views
0 votes
1 answer

How do I give text or an image a transparent background using CSS?

Use either a semi-transparent PNG or SVG ...READ MORE

answered May 27, 2022 in CSS by Edureka
• 12,690 points
399 views
0 votes
1 answer

How to set Bullet colors in UL/LI html lists via CSS without using any images or span tags

I use jQuery for this: jQuery('li').wrapInner('<span class="li_content" />'); & ...READ MORE

answered May 27, 2022 in CSS by Edureka
• 12,690 points
769 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP