Case 1: When I defined a class WITHOUT specifying "background-color" and create a div with that class, I obtain a tranparent object (I can see what is behind it). Case 2: When I defined a class WITH specifying "background-color" and create a div with that class, I obtain an opaque object of that color (I can NOT see what is behind it). In Case 2, if I use Javascript to dynamically change the backgroundColor of that div the expected thing happens: the color of the object changes to the new specified color. My question: Given a class as in Case 2 and given a div created with that class, how can I use Javascript to dynamically change that div to make it appear as a div produced by the class of Case 1? Thank you.
You mean you want js to turn the opaque coloured background of a div to transparent? If this is happening on :hover or other pseudo-classes, CSS alone can do it.
<script type="text/javascript"> document.getElementById('divid').style.background = 'transparent'; </script> HTML:
Thank you guys. The suggestion of xemiterx does the job. I did not understand the answer of Stomme_Poes.