Question:
SITUATION #1: I have tables with different styles. When I go back to Table №1, Table №3, and Table №4 it takes styles from Table №2. How can I apply styles to Table №2 for this table only? Is there a style prefix for different tables?The global style for Table №1, Table №3, and Table №4 are called
grid-custom.css
:grid.css
:The first situation is done. When just one id is applied to the table it works.
SITUATION #2: I have global styles that apply to two tables. But after global styles, I need to apply a separate style for each table
border-radius
. In this case works just for #table1. Why? Same styles:Answer:
You have 2 CSS files. Assuming,global
file as which is applied on App.js
for all components, and local
for specific component. If you specifically want to apply css to Table 2 only then you need to assign id
to div like this :id
with table2 not on other tablesUPDATE:
The CSS is only getting applied on one table and not on other table. I can’t figure it out why! But using 4th method: CSS Modules, I managed to get the result.
Create a file named like
style.module.css
. Inside the file write your CSSclassName
to your divtable2
, and you can remove id
from divs as they are of no use now.If you have better answer, please add a comment about this, thank you!