Adaptive Font Color in Table | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Adaptive Font Color in Table

Guys, I have made a table in HTML and CSS and I want to change the Fonts Color according to the Background Color automatically so that it is clearly visible. How can I do that? Any help would be Appreciated.

16th Sep 2019, 11:17 AM
Saurabh Thakur
Saurabh Thakur - avatar
3 Answers
+ 1
Try this bro: body{ background-color:#fff; } p{ color:#fff; filter: invert(100%); }
16th Sep 2019, 11:41 AM
Thống Nguyễn
Thống Nguyễn - avatar
+ 1
I didnt do that yet but that link might help you https://css-tricks.com/switch-font-color-for-different-backgrounds-with-css/ The css code you can put in html or css. Mostly, css is preferred. If you put it into html, you need to put it inside <style> css code </style>
16th Sep 2019, 6:03 PM
CodeX
CodeX - avatar
0
@Thống Nguyễn Bro! I am new to HTML so could You please tell me that do I need to Copy this code to HTML or CSS? And I want to apply this to Table Components. Thanks for the Help!
16th Sep 2019, 12:06 PM
Saurabh Thakur
Saurabh Thakur - avatar