Is there a way to ensure that all elements on a page display properly across all screen resolutions without being cut off?

My website consists of three main elements: pictures, Cards (containing pictures and various typography), and Buttons. These elements are arranged in a column layout.

The issue I am facing is that the pictures and buttons get cut off on the screen due to resolution constraints. How can I ensure that all three elements fit perfectly within the page without being cut off?

This is the desired outcome: https://i.stack.imgur.com/y0t4k.png

The current problem is that the pictures and buttons are not fully visible. https://i.stack.imgur.com/cTxxF.png

Below is the code snippet I am using:

<Box
  sx={{
    display: 'flex',
    flexDirection: 'column',
    alignItems: 'center',
    justifyContent: 'center',
    width: "100%",
    height: "100%",
    overflow: 'auto',
  }}
> 

  <Grid
    container
    direction="column"
    alignItems="center"
  >
    <Grid item>
      <CardMedia
        component="img"
        image="logo.png"
        alt="logo"
        sx={{
          width: { xs: '80%', sm: '100%', md: '100%', lg: '100%', xl: '100%' }
        }}
        style={{ margin: '0 auto' }}
      />
    </Grid>
  </Grid>

  <Grid container direction="row" justifyContent="center">
    <Grid item xs={9} sm={8.6} md={6} lg={5} xl={4}>
      <Card 
        sx={{
          backgroundColor: 'white',
          borderRadius: '4px'
        }}
      >
        <Box
          sx={{mt:4, mb:4, mx:4}}
        >
          <Box>
            <Stack 
              direction={{xs: "column", sm: "row"}}
              alignItems={{xs: "center", sm: "flex-start"}}
              justifyContent={{xs: "center", sm: "flex-start"}}
              spacing={{ xs: 0, sm: 3}}
            >
              <CardMedia
                component="img"
                sx={{ width: {xs: 120, sm: 160}, height: {xs: 120, sm: 160} }}
                image="image.png"
                alt="image"
                style={{borderRadius: "6px"}}
              />
              <Box
                sx={{wordWrap: "break-word", overflow: "hidden"}}
              >
                <Typography>
                  .....
                </Typography>
                <Typography>
                  .....
                </Typography>
              </Box>
            </Stack>
          </Box>
        </Box>
        <Box
          sx={{mx:4, mb: 10, wordWrap: "break-word", overflow: "hidden"}}
        >
          <Box>
            <Typography>
              .....
            </Typography>
            <Typography>
              .....
            </Typography>
          </Box>
          <Box
            sx={{mt:2}}
          >
            <Typography>
              .....
            </Typography>
            <Typography>
              .....
            </Typography>
          </Box>
        </Box>
      </Card> 
    </Grid>
  </Grid>

  <Grid container direction="row" justifyContent="center">
    <Grid item xs={9} sm={8.6} md={6} lg={5} xl={4}>
      <Button 
        onClick={() => setStep(2)}
      >
        Next
      </Button>
    </Grid>
  </Grid>
</Box>

Answer №1

Consider incorporating padding into the styling of the container element.

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

Struggling to click on a link while viewing the site on your mobile device?

Recently dove into the world of implementing mobile responsive design for a website I've been working on. While conducting some testing, I observed that the main tabs which direct users to different sections of the site, normally easy to click on desk ...

Ensure that all of the <li> elements within a <ul> container have equal widths

I've been grappling with this problem for the past day, and despite restarting from scratch multiple times, I can't seem to make a horizontal CSS flyout header function as intended. The dropdown section should expand to fit the content width (id ...

Error in React Component Library: The identifier 'Template' was not expected. Instead, '}' is expected to end an object literal

I've embarked on the exciting journey of creating my own React component library. Utilizing a helpful template found here, I've shaped the latest iteration of my library. To test its functionality, I smoothly execute the storybook with yarn stor ...

The function componentWillReceiveProps in the lifecycle is invoked several times

I have been following Tyler McGinnis' React curriculum to learn how to build a weather app. I've encountered a strange behavior that I'm having trouble debugging. It seems like I might be missing some key information or making a simple mista ...

Utilizing v-for and CSS Grid to showcase data effectively

I'm having trouble organizing my Vuex data with CSS GRID. It's turning out messy. My setup includes two columns: the first one for labels and the second for values. {{$store.state.stepOne.textfield[idx].label}} The code above is used to displa ...

The 'dehydratedState' attribute is not found in the 'object' type

Encountered an error stating "Property 'dehydratedState' does not exist on type '{}'" when attempting to include a pageProps dehydratedState. The goal was to set up the Next.js app for React Query following the documentation provided on ...

Ways to determine the number of duplicate items in an Array

I have an array of objects that contain part numbers, brand names, and supplier names. I need to find a concise and efficient way to determine the count of duplicate objects in the array. [ { partNum: 'ACDC1007', brandName: 'Electric&apo ...

Traversing JSON Data using Vanilla JavaScript to dynamically fill a specified amount of articles in an HTML page

Here is the code along with my explanation and questions: I'm utilizing myjson.com to create 12 'results'. These results represent 12 clients, each with different sets of data. For instance, Client 1: First Name - James, Address - 1234 Ma ...

Controlling the behavior of React components in response to updates

I'm currently learning ReactJs and utilizing the ExtReact framework for my project. I have successfully implemented a grid with pagination, which is functioning well. I customized the spinner that appears during data loading and it works as expected ...

The UseEffect function ceases to function properly upon refreshing the website

I'm currently using ReactJS for a project. I have a form that is intended to serve as the configuration for another form. The structure of this specific form is as follows: const [startingDate, setStartingDate] = useState(); const [endingDate, set ...

I'm using SASS in my project, can you provide guidance on customizing the UI with @aws-amplify/ui

I've recently taken over a Next.js (React) project from another developer and they've used .scss files (SASS) for styling. The specific project I'm working on can be found here https://github.com/codebushi/nextjs-starter-dimension My task n ...

Creating dynamic class names in Tailwind CSS is a great way to customize your styles on

Currently in the process of creating a component library for my upcoming project using TailwindCss, I encountered a minor issue while working on the Button component. When passing a prop like 'primary' or 'secondary' that corresponds t ...

What is the process of running PHP in a .ctp file within the CakePHP framework?

I have recently started working with CakePHP and I have a question about how PHP code is executed in a file with the .ctp extension. Can you explain how PHP is processed within a .ctp file in CakePHP? Additionally, I'm also curious about executing PHP ...

Experimenting with animating an element through onClick event using JavaScript

I would like to create an animated div using JavaScript that activates on click. <div class="Designs"> <p>Designs</p> <div class="Thumbnails" data-animation="animated pulse"> <a href=" ...

The date-fns parse function will retrieve the value from the previous day

When attempting to parse a date using the date-fns library, I am encountering an issue where the resulting date is one day prior. How can this be resolved in order to obtain the correct result? start = '2021-08-16' const parseStart = parse(start, ...

Dealing with 404 errors in both server.js and the client side utilizing NextJS and next-routes

I'm in search of a more elegant solution for my next-routes to gracefully handle file not found (specifically route not found) when executing from server.js (server side) and also while operating on the client side with Link. The current solution I ha ...

Utilizing Bootstrap 4 to ensure the final DIV is vertically stacked and fills the remaining space in the container

Having trouble creating a responsive layout using Bootstrap 4? Specifically, when two divs wrap vertically on smaller devices, the top div pushes the lower div down, exceeding the parent container. I want the lower div to fit within the container. How can ...

React allows us to declare arrays in the state using this.state

**I am attempting to create an array with 5 values that I can access using nameArray[number]. It seems like there might be an issue with how the array is being declared, but I'm not sure how to correct it. My thought process is this: I have 5 buttons ...

Error in Next.js - missing property "children" in type {}

When using react and nextjs, I encountered an issue with my code that resulted in an error regarding the children prop. The error message states "Property children does not exist on type {}". Below is the snippet of code causing the error: import { NextPag ...

Using mySQL to power your server in a React Native application

Is Realm sufficient as a local database for app development, or is MySQL required for the server database? ...