Striped Table With Period
Striped Table With Period
gultekinb
Posts: 1Questions: 1Answers: 0
I use "table-striped" class to add striped rows to my table. But I want to stripe my table 4 by 4. I mean first 4 row is gray, next 4 row is white then the next 4 row is gray again. Is there any way to choose the period of stripe?
Answers
There isn't anything built into Datatables for this. You might be able to use . Maybe this SO thread will have something that will work for you.
Right click on one of the rows and use the browser's inspect tool to see what selector Datatables is using for your rows, for example
table.dataTable tbody tr
. Also you might need to removedisplay
orstripe
classes from the -table
tag. See the table classes docs for details. You might have additional steps if you are using a styling framework.See this example using an adjusted selector from the first response in the SO thread.
https://live.datatables.net/bopomepi/1/edit
Kevin
Just a little addition here, use the
nth-child()
selector which can be setup to do what you want.Allan