I'm using react.js (in the example the create react app) and I even created two components, but I could not isolate the .css of each component. The css of the Info.css table ends up being applied to the other components that have the same classes, ie it is global . How can I isolate the TableInfo.css to be applied only in the TableInfo
According to my research it would be something like Scoped CSS of Vue.js .
TableInfo.js
import React from 'react';
import styles from './tabelaInfo.css';
export default class TabelaInfo extends React.Component {
render() {
return (
<table>
<thead>
<tr>
<th>Nome</th>
<th>Tipo</th>
<th>Altura</th>
<th>Peso</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bulbasauro</td>
<td>Planta</td>
<td>2</td>
<td>100kg</td>
</tr>
</tbody>
</table>
)
}
}
TableInfo.css
table{
width: 100%;
table-layout: fixed;
border-collapse: collapse;
}
table tr th{
background-color: #f1f1f1;
border: 1px solid #dadada;
height: 30px;
padding-left: 10px;
font-size:15px;
color: #333333;
font-weight: 500;
padding-top: 6px;
text-align: left;
}
table tr td{
border: 1px solid #dadada;
height: 30px;
padding-left: 10px;
font-weight: normal;
font-size: 15px;
padding-top: 6px;
}