I want this css code to work:
#inventoryGarbageSpot .id1,.id2,id3,id4{
padding:0px;
padding-top: 0px;
width:35px;}
If I write one id instead of multiple ids it works.
Thanks for your help,
Rotem
If we decompose your selector, you're targeting :
#inventoryGarbageSpot .id1.id2id3id4First, there're 2 non-existent elements : id3 and id4, which will stand for this kind of elements :
<id3></id3>
<id4></id4>
Secondly, you need to repeat your #inventoryGarbageSpot before each class.
Instead of this unefective selector, use this one :
#inventoryGarbageSpot .id1,
#inventoryGarbageSpot .id2,
#inventoryGarbageSpot .id3,
#inventoryGarbageSpot .id4 {
padding:0px;
padding-top: 0px;
width:35px;
}
If you want to generalize your selector, you can use an attribute selector, as mentioned by Sudharsan.
Use attribute selector like this
style be
#inventoryGarbageSpot [class^="id"]{
padding:0px;
padding-top: 0px;
width:35px;
}
that should be
[class^="id"]{
// here style
}