Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set div background color to 'none' using jQuery's css?

Tags:

jquery

css

$('#element').css({'background-color':'none'}); 

The code above doesn't work. Is there a way to do it?

like image 589
exd Avatar asked Nov 21 '09 21:11

exd


People also ask

Can you do background color none?

Yes. Since the initial value is transparent , that is what you use if you want to turn background coloring "off".

How do I keep background color transparent in CSS?

To set the opacity of a background, image, text, or other element, you can use the CSS opacity property. Values for this property range from 0 to 1. If you set the property to 0, the styled element will be completely transparent (ie. invisible).

Can a div be transparent?

If you just want your element to be transparent, it's really as easy as : background-color: transparent; But if you want it to be in colors, you can use: background-color: rgba(255, 0, 0, 0.4);


1 Answers

you can use one of these two options (i recommend the second one):

option 1:

$('#element').css('background-color','transparent'); 

option 2:

$('#element').css('background-color','inherit'); 
like image 124
Alireza Eliaderani Avatar answered Sep 21 '22 21:09

Alireza Eliaderani