In my React component, I have a form that is structured like this:
<Box
display="flex"
justifyContent="center"
alignItems="center"
style={{ minHeight: "100vh", backgroundColor: "gray", opacity: "0.8" }}
> ...
</Box>
This form component, named Form, is then included in App.js
in the following way:
import React from "react";
import Form from "./components/Form";
const sectionStyle = {
height: "100vh",
backgroundImage:
"url('www.blablabla.com/img.jpg') ",
backgroundRepeat: "no-repeat",
backgroundSize: "cover"
};
const App = () => {
return (
<div style={sectionStyle}>
<Form />
</div>
);
};
export default App;
However, the output I get looks like this:
https://i.sstatic.net/1jENj.jpg
I used opacity to emphasize that my Box
component is covering the entire window, whereas I want it to only wrap around its content. This way, if opacity is applied, it will only affect the inside of the Box
, while the background image remains unaffected.
Is there a way for me to achieve this?