What is the best way to ensure that a React app is always displayed in full screen

I am facing an issue while developing an app with React and Material UI. I am trying to display the app in full-page mode, but unable to achieve it successfully. Currently, it appears like this:

Here is my code snippet from App.js:

import 'typeface-roboto';
import './css/App.css'
import React from 'react';
import ArticlePage from "./pages/article";
import ProfilePage from "./pages/profile";
import {MuiThemeProvider} from "material-ui";
import CssBaseline from "@material-ui/core/CssBaseline";
import {BrowserRouter as Router, Switch, Route} from "react-router-dom";
import NavBar from "./components/NavBar";
import HomePage from "./pages/home";
import InboxPage from "./pages/inbox";

function App() {
    return (
        <MuiThemeProvider>
            <div className="App">
                <Router>
                    <CssBaseline/>
                    <NavBar/>
                    <Switch>
                        <Route path="/profile">
                            <ProfilePage profileName={"Denis Ivanenko"} dateTime={"2017-02-14"}
                                         userBio={"Example of User Bio. Here User can write about himself."}/>
                        </Route>
                        <Route path="/article">
                            <ArticlePage
                                imageSrc={"https://insights.dice.com/wp-content/uploads/2017/09/shutterstock_315465929.jpg"}
                                text={"...content goes here..."}
                                authorImageSrc={"...image source here..."}
                                ...more props...
                            />
                        </Route>
                        <Route path="/inbox">
                            <InboxPage name={"Denis"} surname={"Ivanenko"}
                                       messages={[{...message object 1...},
                                                 {...message object 2...}, 
                                                 {...message object 3...}]}/>
                        </Route>
                        <Route path="/">
                            <HomePage/>
                        </Route>
                    </Switch>
                </Router>
            </div>


        </MuiThemeProvider>
    );
}

export default App;

The stylesheets used are defined in App.css:

.App {
    background: #485563;
    background: -webkit-linear-gradient(to right, #29323c, #485563);
    background: linear-gradient(to right, #29323c, #485563);
    height: 100%;
    margin: 0;
    padding: 0;
}

P.S. As I'm new to front-end development, please excuse me if this question seems basic. I suspect there might be an issue with setting the background color. Can anyone assist me with this? Since I am using React router in my app, below is the code for a specific page:
Inbox.js :

import React from "react";
import Paper from "@material-ui/core/Paper";
import Container from "@material-ui/core/Container";
import '../css/Inbox.css';
import {Divider} from "@material-ui/core";
import AvatarImage from "../components/AvatarImage";


export default class InboxPage extends React.Component {
    render() {
        const name = this.props.name;
        const surname = this.props.surname;
        const messages = this.props.messages;
        return (
            <Container>
                <Paper>
                    <h1 className={"inboxHeader"}>{name}{" " + surname + "`s"} Inbox:</h1>
                    <Divider/>
                    {messages.map((message) =>
                        <Container>
                            <AvatarImage className={"AvatarImage"}/>
                            <h2>{message.author}:</h2>
                            <p>{message.text}</p>
                            <Divider/>
                        </Container>
                    )}
                </Paper>
            </Container>
        );
    }
}

Inbox.css :

.inboxHeader {
    text-align: center;
}

h2, p, img {
    display: inline-block;
}
.AvatarImage{
    display: inline-block;
}
.flexbox {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
}

Answer №1

Did you give this a shot?

.App {
  margin: 0;
  padding: 0;
  min-height: 100% //or 100vh
}

Answer №2

To enhance your style sheet (App.css), include the following code at the beginning.

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

Sending Image Data in Base64 Format with Ajax - Dealing with Truncated Data

My current challenge involves sending Base64 image data through ajax to the Server. I've noticed that sometimes all the pictures are successfully sent, but other times only a few make it through. Does anyone have suggestions on how to implement error ...

Utilizing a for loop to render various elements within a component

Currently, I am in the process of creating a custom Section class that will include a headline and multiple paragraphs. export default class Section extends React.Component { render() { return( <article> <header> ...

Options for HTML technologies in an application designed for managing enterprise metadata

Challenge We are facing the decision of determining which technologies to adopt as we transition from a rich client Silverlight application to an HTML-based client that can accommodate a metadata driven approach. Situation Our enterprise has been using ...

React event handling

Currently, I am in the process of developing an accordion app using React. The data for this app is fetched from an API, and while I have the basic structure of the app ready, I am facing some difficulties with handling the click event on the accordion. H ...

Ways to determine if an element has exceeded its container's boundaries

After creating the codesandbox, I have developed a webapp that heavily relies on user input. To keep it simple for demonstration purposes, I am displaying various authors on an A4 formatted page using `page` and `font-size` with the `vw` unit for responsiv ...

What is causing the alt or title tags to not function properly in emails?

I am currently facing an issue with e-mail templates that include images. The problem arises from the fact that these images need to be downloaded before they can be displayed in the email. To work around this, I always use ALT and TITLE tags to provide de ...

VueRouter child route with trailing slash after default

VueRouter automatically includes a trailing slash before the child route's path. Consider this example of a route configuration: const routes = [ path: '/home', components: { default: HomeBase }, children: [ ...

Issue persists: Ajax functionality remains nonfunctional, prompting the need for

My goal is to use the post input, and upon hitting enter, I want to dynamically replace <div id="mainPagePosts"></div> with new data without causing a page refresh. However, even after submitting the post, the page still refreshes, although I d ...

The websocket server implemented in Node.js with the use of the "ws" library is exhibiting a peculiar behavior where it disconnects clients at random intervals,

My WebSocket server implementation is quite simple: const WebSocket = require('ws'); const wss = new WebSocket.Server( { server: server, path: "/ws" }); wss.on('connection', function connection(ws, req) { console.log("Connect ...

I encountered an issue when trying to generate a React app using the command npx create-react

When I attempted to run the command npx create-react-app in my terminal, I encountered the following error message: npm ERR! code E403 npm ERR! 403 403 Forbidden - GET https://registry.npmjs.org/create-react-app npm ERR! 403 In most cases, you or one of ...

Foreign keys in a one-to-many relationship with Sequelize.js

I am in the process of developing a survey application using Node.js/Express and MySQL incorporating Sequelize.js ORM. However, I am encountering difficulties while establishing the relationship between the two models. My goal is to have the Questions&apo ...

What is the best way to use multiple encoding types when sending data via a POST method in Node.js?

My current challenge involves sending a combination of name and description text data alongside a video file. Unfortunately, I've encountered an issue where I can only send either the video or the text, but not both simultaneously. Below is the code ...

Exploring the world of graphql fragment masking with the power of keys

When it comes to developing GraphQL clients, fragment masking is often recommended as a best practice. However, I'm struggling to understand how to implement basic React functionalities with such complexity. A common necessity is providing key propert ...

jQuery rounded images slideshow

Currently, I am working on developing a jquery slider that showcases rounded images. Below is the HTML code: jQuery(document).ready(function($) { var $lis = $('ul').find('li'), length = $lis.length; $lis.each(function( ...

Retrieving the value of a PHP function using JavaScript

After reviewing various answers, I am still unsure of how to proceed with my issue. Here is the dilemma I'm facing: I am working with a .txt file to extract and interpret the meaning of a name (even though using a database would be more efficient). ...

Inconsistent Accuracy of React Countdown Timer

Hello everyone! I'm new to programming and I'm currently working on creating a countdown timer that goes from 3 to 0. The issue I'm facing is that the timer counts down too quickly when rendered on the screen. I've tried adjusting the i ...

Combining the powers of Javascript and Drupal can create

My current setup includes an "open video" button and a form that triggers an ajax call to render files with the corresponding buttons when users click on handouts or videos. I have encountered a problem: Whenever I click on "open the video" after renderi ...

Learn the process of setting up a connection between Express JS and the NotionAPI using both POST and

As someone who is new to backend development, I am currently working on integrating a simple Notion form into a Typescript website. To guide me through the process, I found a helpful tutorial at . The tutorial demonstrates how to send data from localhost:3 ...

Understanding the inner workings of a Mongoose model without the need for

server.js process.env.NODE_ENV=process.env.NODE_ENV || 'development'; var mongoose=require('./config/mongoose'); express=require('./config/express'); var db=mongoose(); var app=express(); app.listen(3000,function(){ ...

Removing dropdown lists from input forms can be achieved without using jQuery by utilizing vanilla JavaScript

Looking to build a custom HTML/JavaScript terminal or shell. Interested in utilizing an input box and form to interact with JavaScript functions/commands. Unsure of how to eliminate the drop-down menu that appears after previous inputs. Pictured terminal: ...