Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74045

dynamic css at class level

$
0
0

I have a JSP code like below.

<table id="mytable" cellspacing="0">
<tr data-depth="0" class="collapse level0">
<td></td>
<td></td>
<td></td>
</tr>
////...
/...//
<tr data-depth="<%=dataDepth%>" class="collapse level<%=dataDepth%>">
<td></td>
<td></td>
<td></td>
</tr>
</table>

and below is the css for class level

.level1 td:first-child {
    padding-left: 15px;
}
.level2 td:first-child {
    padding-left: 30px;
}
.level3 td:first-child {
    padding-left: 45px;
}
.level4 td:first-child {
    padding-left: 60px;
}
.level5 td:first-child {
    padding-left: 75px;
}

The above code for class is harcoded for level1,level2,level3,level4,level5. But from JSP code the class level is dynamic and can keep increasing based on <%=dataDepth%> and this has no limit. Can the css also change dynamically with respect to JSP code? Any examples or suggestions please?


Viewing all articles
Browse latest Browse all 74045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>