Row background colour
Row background colour
Gaz96
Posts: 20Questions: 6Answers: 1
Whats the easiest way to change the background colour of the row stripe?
Answers
If you just want to change the tint:
where the value is an rgb value, comma separated.
If you want complete control this is the CSS to overrule:
Assuming of course that you are using the DataTables default styling.
Allan
Magic. Where do I put that code??
In a style tag, or a custom CSS file if you have one.
Allan
Hi Allan
I added the following in between the head tags but to no avail - sorry for my ignorance:
<style type="Text/CSS">
:root {
--dt-row-stripe: 255, 0, 0;
}
</style>
That seems to work okay for me here: https://live.datatables.net/visoliha/1/edit .
As I say, it is a tint only. If you want complete control, you need to override the CSS DataTables is using.
Please link to a page showing the issue if you are still having problems with it.
Allan
Try this:
https://www.dot-ball.uk/index.php?birthday=2023-08-06
Oh, cracked it. Needed a reference to <link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
Thanks so much for your help
Gary :-)
Oh - were you using an old version? Yes, that way of controlling the stripe colour was quite new.
Good to hear you got it done.
Allan