It seems to me that you are setting the target of the action to be taken by jQuery in the wrong way.
In your CSS you have:
.three-columns .content { ... }
.content { ... }
To hit the same element via jQuery you have to use the same selector:
$(".three-columns .content").css({
'margin' : '10px 10px 10px 10px'
});
$(".content").css({
'margin' : '10px 10px 10px 10px'
});
On the other hand, it looks like you’re repeating the code, since if you want to change the margin
element with CSS class content
, just one line:
$(".content").css({
'margin' : '10px 10px 10px 10px'
});
But if there’s something else you’re not presenting in the question, you can also use a single line to set the same style for both elements by making use of selector separation:
$(".three-columns .content, .content").css({
'margin' : '10px 10px 10px 10px'
});
If you want to simplify, since the margin value is equal to the top, right, bottom and left, you can use:
$(".three-columns .content, .content").css({
'margin' : '10px'
});
That’s right, thank you!
– CesarMiguel