I have a few divs created dynamically in Javascript.I was wondering if it is possible to style them all at once.
#somediv {
background-color: #F2F5FC;
border-style:solid;
border-bottom:thin dotted #33ccff;
}
#somediv2 {
background-color: #F2F5FC;
border-style:solid;
border-bottom:thin dotted #33ccff;
}
…and so on (this can be even 50 divs)
I would like to change this to something like:
#somediv* {
background-color: #F2F5FC;
border-style:solid;
border-bottom:thin dotted #33ccff;
}
If they are going to be styled exactly the same, use a class, look here for the difference:
Then your divs are like this:
Just edit your script to include the class attribute, by far the easiest solution…and this is exactly what classes are for 🙂