I am trying to incorporate 4 arrow images into a CSS class (up, down, right, left).
I started with a basic arrow css class:
.arrow {
background-repeat: no-repeat;
background-position: center;
}
Next, I created subclasses like:
.arrow .up {
background-image: url("../img/arrow-up.png");
}
arrow .down {
background-image: url("../img/arrow-down.png");
}
However, when I apply both classes to a table cell using jQuery, the image does not display. I discovered that by combining them into 1 class, for example:
.arrow-up {
background-image: url("../img/arrow-up.png");
background-repeat: no-repeat;
background-position: center;
}
and then adding it to the table cell, it works without any issues.
Is there a way to avoid repeating the "background-repeat" and "background-position" in every class?