When using CSS, the styling properties are applied inline with style="..."
, rather than modifying the .class itself.
$('.class').css
doesn't have any effect.
$('.class').css('color','red')
sets a color style.
$('.class').css('color')
reads the color style.
To target img
elements within an element with class "cellBox":
var borderx = "1px solid red";
$('.cellbox img').css('border', borderx);
(You can set other styles like padding
in the same way.)
(Note that jQuery's documentation states that shorthand properties like padding
or border
may not be fully supported; this mainly applies to retrieving properties, while setting them [like above] typically works due to browser implementations.)