Column Alignment
columnDefs: [
{ targets: [1, 2], className: "cssMyRightAlign" },
],
CSS
.cssMyRightAlign{
text-align: right;
}
But its not aligning column 1 & 2 in right.
Codepen Link
https://codepen.io/Sixthsense6/pen/KKeRPXJ
Column Alignment
columnDefs: [
{ targets: [1, 2], className: "cssMyRightAlign" },
],
CSS
.cssMyRightAlign{
text-align: right;
}
But its not aligning column 1 & 2 in right.
Codepen Link
https://codepen.io/Sixthsense6/pen/KKeRPXJ
2
Answers
Finally traced the root cause of the issue.
I stored the JavaScript in separate file and linked it in my Web Page. If I keep the JS in webpage itself then it's working fine.
Storing the Js in separate file and linking the same in webpage header or body is not working as expected.
Looks like
.cssMyRightAlign
is overwritten by a selector with higher precedence. Try adding the!important
keyword to it like so: