Is it possible to combine css styles? I have a table and 4 options to color the lines and also need to variate the style of letters. For example, if the date of the record is expired and the linenumber is 42 (just an example), then its background color have to be red and the fonts’ style italic. If I am good at math, it’s about 16 different states (for example red linecolor + italic fonts, white color + bold fonts, green + italic fonts, etcetc), which could be horrible to write every little state into the scss file.
So my question:
Is it possible, to combine css classes in this way?
For example:
if(redcoloringNeeded()){
table.addStyleName(“RedRowColor”);
}
if(italicFontNeeded()){
table.addStyleName(“ItalicFont”);
}
(And when both clauses are true, the row’s background will be red and the fonts are italic.)
I haven’t tried It out yet, is there something similar way to solve this problem beautifully?
Thanks for your help. In my project I implemented the CellStyleGenerator interface to set every rows’ style uniquely. Do you have any idea, how to set the style row-by-row? I think that I can’t go along with this right now.
I wrote something like you did, but in this way I can’t see how can I avoid to write a novel in the css file - if I understand it well, then this cellstylegenerator can return only one kind of style.
My problem is the same: if I have for example 3 different states than I need to code 9 different kind of stlyes in the css, which wouldn’t be nice and also would be harder to handle it later.