Currently, I have a hero image on my home screen. I have successfully placed an overlay on top of the image and added a bit of opacity to it as well. I am now trying to add a bit of text on top of the overlay/hero image and for some reason, the text appears to be inheriting the opacity from the overlay. I believe it has something to do with the position of the text in relation to the overlay, but I can't seem to make the text sit ontop of my overlay. Any suggestions would be much appreciated! the code is as follows:
import React from 'react'
import Wynbase from '../images/Wynbase.jpg'
// MUI STUFF
import Typography from '@material-ui/core/Typography'
import Grid from '@material-ui/core/Grid'
import Container from '@material-ui/core/Container'
import Box from '@material-ui/core/Box'
import { makeStyles } from '@material-ui/core/styles'
const useStyles = makeStyles(theme => ({
background: {
backgroundImage: `url(${Wynbase})`,
position: 'relative',
objectFit: 'cover',
backgroundPosition: '30% -250px',
width: '100%',
height: 450,
paddingTop: 70,
margin: 0,
backgroundRepeat: 'no-repeat',
// Ipad screen
'@media (max-width: 1024px)': {
backgroundPosition: '50% -300px'
}
},
overlay: {
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%',
opacity: 0.8,
margin: 0,
backgroundColor: '#7FB9C9'
},
overlay_text: {
padding: '200px 0',
// fontWeight: 'bold',
postion: 'absolute',
color: 'white',
textAlign: 'center'
}
}))
const Home = () => {
const classes = useStyles()
return (
<Box>
<Box className={classes.background}>
<div className={classes.overlay}>
<Container className={classes.overlay_text}>
<Typography variant="h3">Welcome to JobTracker</Typography>
<Typography variant="h3">
Tracking Your Job Applications Made Easy
</Typography>
</Container>
</div>
</Box>
<Box>
<Container>More stuff will go here</Container>
</Box>
</Box>
)
}
export default Home