Answer the question
In order to leave comments, you need to log in
What am I doing wrong with modular styles?
Component:
import React, {Component} from 'react'
import styles from './Videos.module.css'
export default class Videos extends Component{
render(){
return(
<div id="test1" className={`row ${styles.VideoRoom}`}>
<div className={`col s12 center grey lighten-3 ${styles.HostVideo}`}>
Видео хоста
</div>
<div className={`col s12 center grey lighten-3 ${styles.MemberVideos}`}>
Видео участников
</div>
</div>
);
}
}
.VideoRoom{
padding: 2rem 0;
}
.HostVideo{
padding: 5rem 0;
}
.MemberVideos{
padding: 15rem 0;
}
Answer the question
In order to leave comments, you need to log in
The selector .col.s12
has more specificity than the css class from the module. To fix, separate the grid structure from the component structure:
import React, {Component} from 'react'
import styles from './Videos.module.css'
export default class Videos extends Component{
render(){
return(
<div id="test1" className={`row ${styles.VideoRoom}`}>
<div className="col s12 center grey lighten-3">
<div className={styles.HostVideo}>
Видео хоста
</div>
</div>
</div>
);
}
}
:global(.class)
in css modules ( more info ). It should be something like :global(.col).HostVideo
. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question