I found myself pondering the method to achieve the slightly blue tinted box that sits behind the image

Can you assist me in achieving this specific look? I have my MUI app bar and home page set up, but I'm unsure how to create the blue-ish box behind the image. Should I place the container within my app bar or integrate it into my homepage file? Additionally, there's a significant gap between the app bar and title in my current design that I would like to eliminate.

Desired outcome: https://i.stack.imgur.com/18glc.png

Current result: https://i.stack.imgur.com/BxG9x.png



Here is a snippet of the code:

return (
    <ThemeProvider theme={theme}>
        <Grid container component="main" sx={{ backgroundColor: '#FBF3EA', display: "flex", justifyContent: "center", position: 'absolute' }} >
            <Box component="section">
                <Container sx={{ py: 10 }} maxWidth="lg">
                    <Grid container alignItems="center" spacing={3}>
                        <Grid item xs={12} md={5}>
                            <Box sx={{
                                display: 'flex',
                                ml: '850px',
                                width: '500px',
                                mt: '-160px'
                            }}>
                                <Container sx={{backgroundColor: '#99CCCB', width: 300, height: 500 }} xs={12} sm={6} md={6}></Container >
                            </Box>
                            <Typography component="h1" variant="h3">
                                Real Pet food fresh from the fridge.
                            </Typography>
                            <Stack direction="row" spacing={2} sx={{ mt: 4 }}>
                                <Button size="large" variant="contained" sx={{
                                    backgroundColor: '#124944',
                                    textTransform: 'none'
                                }}>
                                    Shop Now
                                </Button>
                            </Stack>
                        </Grid>
                        <Grid item>
                            <Grid container sx={{display: 'flex', flexWrap: 'nowrap'}}>
                                <Grid item>
                                    <img width="150px" height="175px" src={dogHome} alt="dog food" />
                                </Grid>
                                <Grid item sx={{width:'100%'}}>
                                    <Card>
                                        <CardContent>
                                            <Grid container spacing={3}
                                                  sx={{
                                                      "& .MuiGrid-item:last-child > .MuiBox-root": {
                                                          border: "none",
                                                      },
                                                  }}>
                                                <Grid item>
                                                    <Box >
                                                        <Typography fontFamily="Righteous" gutterBottom color="text.secondary" variant="h4" sx={{display: 'flex', justifyContent: 'center'}}> 200 + </Typography>
                                                        <Typography fontFamily="Righteous" variant="h5" sx={{display: 'flex', justifyContent: 'center'}}> Nutritional Complete </Typography>
                                                    </Box>
                                                </Grid>
                                                <Grid item>
                                                    <Box>
                                                        <Typography fontFamily="Righteous" gutterBottom color="text.secondary" variant="h4" sx={{display: 'flex', justifyContent: 'center'}}> 1k </Typography>
                                                        <Typography fontFamily="Righteous" variant="h5" sx={{display: 'flex', justifyContent: 'center'}}> Product Sales </Typography>
                                               </Box>
                                                </Grid>
                                                <Grid item>
                                                    <Box>
                                                        <Typography fontFamily="Righteous" gutterBottom color="text.secondary" variant="h4" sx={{display: 'flex', justifyContent: 'center'}}> 96% </Typography>
                                                            <Typography fontFamily="Righteous" variant="h5" sx={{display: 'flex', justifyContent: 'center'}}> Client Satisfaction </Typography>
                                                    </Box>
                                                </Grid>
                                            </Grid>
                                        </CardContent>
                                    </Card>
                                </Grid>
                            </Grid>
                        </Grid>

Answer №1

To achieve the desired positioning, apply position: absolute and z-index: -1 to your Box component:

<Box sx={{
    display: 'flex',
    position: 'absolute',
    top: '0px',
    right: '200px', // make adjustments here
    width: '500px',
    zIndex: '-1'
}}>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Streamlining all icons to a single downward rotation

I am currently managing a large table of "auditpoints", some of which are designated as "automated". When an auditpoint is automated, it is marked with a gear icon in the row. However, each row also receives two other icons: a pencil and a toggle button. W ...

What steps do I need to take to activate the AWS Location Services map in a React application, allowing unauthenticated users through AWS C

Currently, I'm developing a react application that incorporates a map by utilizing AWS Location Services. Instead of relying on the tutorial's implementation of user authentication through AWS Cognito, which conflicts with our in-house authentica ...

Aligning images in center of list

I'm in need of some CSS expertise to assist with this layout. Here is the current structure: <div class="movieList"> <div class="image" selected = true> <img class="poster" src="image1" selected = true/> </div> <d ...

An issue occurred with player.markers not being recognized as a function when trying to utilize videojs markers

I am trying to add markers to my videojs player timeline. I have successfully implemented this feature a few months ago in a different project, but now when I try to use it again, I am encountering errors in the console and unable to see the markers on the ...

Attempting to show different fields depending on the chosen option

Having an issue with the signup process for my team and competition setup. I want to implement a feature where, if the user selects 'Competition', the promo code field will be displayed. However, this field should only appear when 'Competiti ...

What is the code to trigger a dialog box for the date picker in a @material-ui/core textfield using a button click

Is there a way to trigger the opening of the date dialog for this @material-ui/core native textfield by using a button programmatically? I explored using import { DatePicker } from "@material-ui/pickers" However, I found it to be unnecessary for my specif ...

Dynamic Object properties are not included in type inference for Object.fromEntries()

Hey there, I've been experimenting with dynamically generating styles using material UI's makeStyles(). However, I've run into an issue where the type isn't being correctly inferred when I use Object.fromEntries. import * as React from ...

Simulation environment facilitator

I am working on testing a component that relies on context provided by another component. import { MuiPickersUtilsProvider } from 'material-ui-pickers'; import DateFnsUtils from '@date-io/date-fns'; render(( <MuiPickersUtilsProvid ...

Deactivate the option to input dates in the MUI MobileDatepicker

Having an issue with the MUI MobileDatePicker pencil button that changes the view. My objective is to allow users to only select a date without typing it in. https://i.stack.imgur.com/5hUEM.png <MobileDatePicker label="For mobile" value={ ...

Tips for customizing the appearance of a mat-select chosen item?

Is there a way to modify the color of the selected option text in a mat-select component within an Angular 15 project? .html <mat-form-field> <mat-label>From</mat-label> <mat-select panelClass="mat-select-red"> ...

Uninterrupted text streaming with dynamic content that seamlessly transitions without any gaps

I'm currently facing a challenge with an outdated element like <marquee>. Here's a fiddle where you can check it out: https://jsfiddle.net/qbqz0kay/1/ This is just one of the many attempts I've made, and I'm struggling with two m ...

Is it possible to prevent website backgrounds from duplicating?

When I visit my website and zoom in using CTRL +, the background image starts duplicating instead of just resizing. Other solutions I've found only stretch the image, which is not what I want. My website has a comments section that can make the length ...

Alter the cursor of a specific child element

I am currently using @material-ui/core: "4.0.1" Attempting to change the cursor of a TextField component to 'not-allowed'. Here is the simple code snippet that I have tried: <TextField style={{cursor:'not-allowed'}} id="st ...

When using Ruby and Rack on Heroku to serve a static site, the CSS styling may not be

Trying to deploy a static site consisting of HTML, CSS, font, and image files with Ruby Rack has been a bit challenging. While the HTML displays perfectly in Chrome when running it locally, the CSS assets do not seem to be loading or being applied to the H ...

Having trouble with jQuery Animate when trying to change the background-color property?

So, I was experimenting with the jQuery .animate() function and decided to change the background color of a div based on how many pixels the user scrolled. Surprisingly, it didn't work as expected. After switching to the .css() function instead, every ...

Styling Angular Datatables with CSS

i have data on the front end https://i.stack.imgur.com/2xq7a.jpg i need all check marks to be displayed in green color. Below is the code snippet: $scope.dtColumnsCal= [ DTColumnBuilder.newColumn('name').withTitle('Name') ...

The Socket.IO server is online and connected, however, the client is currently offline and not connected

I am new to websockets and I am currently working on developing a chat application using socket.io. After following the documentation on the socket.io website, I was able to successfully establish a connection between the server and the client. However, wh ...

Is it possible to populate the blank cells in the weekday columns for previous and following months in a mat-datepicker or mat-calendar's display?

In order to enhance user experience, I am designing a calendar that allows users to select dates. My goal is to populate the empty cells at the beginning of the first week with dates from the previous and next months. For this project, I am utilizing the ...

In React Router v6, you can now include a custom parameter in createBrowserRouter

Hey there! I'm currently diving into react router v6 and struggling to add custom params in the route object. Unfortunately, I haven't been able to find any examples of how to do it. const AdminRoutes: FunctionComponent = () => { const ...

Change the class of an element only within the div that is directly below it

Trying to achieve: Visit this link In my navigation menu, I have two folders with subpages under them. The CSS for displaying the page titles within the folder is as follows: .main-nav .subnav ul {display:none; transition: all 100ms ease-in-out; } .mai ...