What is causing the elements on the screen to not occupy the entire screen?

My web-app on react is not displaying full-screen, even though there are very few elements on the page. https://i.sstatic.net/RYc6D.jpg https://i.sstatic.net/yhqey.jpg https://i.sstatic.net/uKuLD.jpg Css:

html {
  height: 100%; width: 100%;
}
* {
  margin: 0; padding: 0; box-sizing: border-box;
}

body {
  min-height: 100vh;
  display:block;
  position: fixed;
  object-fit: cover;  
  z-index: -2;
  right: 0;
  bottom: 0;
  background-image: linear-gradient(rgba(0, 0, 0, 0.527),rgba(0, 0, 0, 0.5)), url("./assets/background-img.png");
  background-repeat: no-repeat;
  background-position: center top;
  background-position-y: -24em;
  background-size: 100% 100%;
}

I have also applied some additional styles for h-s, but I don't think that's causing the issue, so I removed them. JSX:

  return (
    <>
      <Navbar />
      <div className='header-div'>
        <h3 className='text-above'>
          -------   A HIKING GUIDE
        </h3>
        <div className='main-text'>
          Be Prepared For The Mountains And Beyond!
        </div>
      </div>
    </>
  );

I have already tried various solutions in the code, but I am unable to resolve the issue. I hope you can help me figure it out.

Answer №1

You may want to reconsider your background positioning, as I've made some adjustments.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body,html {
        height: 100%; 
        width: 100%;
        display:block;
        position: fixed;
        object-fit: cover;  
        z-index: -2;
        right: 0;
        bottom: 0;
        background-image: linear-gradient(rgba(0, 0, 0, 0.527),rgba(0, 0, 0, 0.5)), url("./assets/background-img.png");
        background-repeat: no-repeat;
        /* background-position property adjusted */
        background-position: center top;
        /*background-position-y: -24em;*/
        background-size: 100% 100%;
                }
        * {
        margin: 0; padding: 0; box-sizing: border-box;
        }

    </style>
</head>
<body>
    
</body>
</html>

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

Issue with PrimeNG Carousel width on mobile devices

Currently, I am in the process of developing a system interface with Angular and PrimeNG specifically for mobile devices. The main requirement is to have a carousel to display a set of cards. After evaluating different options, I decided to utilize the ngP ...

Retrieve Object Key in Angular 7

I have a specific item: this.item = { name:"Michael", age:18 }; I am looking to display it in an HTML format. name: Michael age: 18 <div >{{ item (name) }}</div> --??? should put name <div>{{ item.name }}</div> < ...

Conquer the issue of incessant AJAX page refreshing

Currently, I am working on an application where I handle numerous form submissions and utilize ajax to send data to a server running on Node.js. One of the features includes updating a table upon button click, which triggers a spinner to load as an indic ...

What is the best way to replicate a div's background color using an image within the body element?

I am looking to achieve a layout similar to the one below: https://i.sstatic.net/1cOYw.png The dark grey color represents the sidebar, but I want to use this color as a repeating vertical image in the body element without covering the footer (light gray) ...

Delicate seams break up the different sections of the webpage

I'm facing an issue with my website where thin lines are appearing between each section when previewed in Safari and Chrome, but not in Firefox (as shown in the images). I've checked the CSS code for each section in Dreamweaver, where the lines d ...

What specific width range would be best for my needs?

I used to have the default font style of Myriad Pro Light and a padding setting for my main menu on my website as follows: .menu > li > a { padding: 17px 15px 15px 15px; } Recently, I changed the default font style to Montserrat. However, this chang ...

What's the best way to ensure that columns clear properly when using bootstrap?

Instead of providing code to solve an issue, I am using Bootstrap and encountering problems with the roster section where the heights are inconsistent. My temporary solutions involved adding classes to specific divs or setting fixed column heights, but I&a ...

Vertically align all items within the div using Bootstrap to achieve perfect centering

I've been working on centering everything within this div vertically, and I've encountered some challenges along the way. Initially, I ensured that my background view extends my container nicely across the screen. Now, I'm looking to create ...

Angular - The confirmDialog from Primeng is appearing hidden behind the modal from ng-bootstrap

I am currently utilizing the primeng and ng-bootstrap components to develop an angular-based website. In order to collect data, I have implemented a form within an ng-bootstrap modal. However, upon clicking the "save" button on the modal, the primeng conf ...

Challenges with Font-face in Internet Explorer 8

I have implemented a custom font-family using the following CSS rule: @font-face { font-family: 'matrix'; src: url('MaSGRgLn.eot'); src: url('MaSGRgLn.eot?#iefix') format('embedded-opentype'), url(' ...

The sidebar scrolling feature seems to be malfunctioning, as only the page scrolling functionality is currently

I'm currently working on a webpage that features a sidebar, along with other elements as shown below: https://i.sstatic.net/gf7dX.png In this design, the Your Friends section represents the sidebar. However, I have noticed that when I hover over the ...

I would like to terminate the property when processing it on a mobile device

<div class="col-sm-24 embed-responsive"> <iframe width="100%" src="http://www.youtube.com/embed/${item.snippet.resourceId.videoId}"></iframe> </div> .embed-responsive iframe { height: 185px; margin-top: -4%; paddin ...

The rotation of an image in Microsoft Edge results in an HTML file display

One of the images on my website is sourced like this: <p> <img src="images/image.jpg" style="width: 50%;" /> </p> Surprisingly, in Chrome and Firefox, the image looks fine (just how I uploaded it to the server). H ...

"Even rows are the only ones being highlighted on the table

I created a table that dynamically highlights all odd rows. To achieve this, I implemented a method to identify the row number and then apply the alt class to those specific rows. In order to highlight the rows on hover, I added a simple :hover selector ...

The tooltip function is not functioning properly on Internet Explorer when the button is disabled

I have been utilizing a similar solution found at http://jsfiddle.net/cSSUA/209/ to add tooltips to disabled buttons. However, I am encountering an issue specifically in Internet Explorer (IE11). The workaround involves wrapping the button within a span: ...

Modify the text inside a div based on the navigation of another div

Hey there, experts! I must confess that I am an absolute beginner when it comes to JavaScript, JQuery, AJAX, and all the technical jargon. Despite my best efforts, I'm struggling to grasp the information I've found so far. What I really need is ...

Creating space between flex items in Slick Carousel with Vue

This is my current Slick Carousel. There are 4 items in a row, and I am looking to insert some margin between each item while maintaining the existing aspect-ratio: 1.3/1; I'm struggling with overriding the classes from vue-slick-carousel. Does any ...

Tips for populating an HTML input with the value of a link element using JQuery

I have a form input that I want to populate with autocomplete suggestions from my database using Ajax. To style the list, I am using bootstrap 4, and I have opted to use the <a></a> tag instead of the <li></li> tag. This is because ...

Various <a> elements adjust the HTML code based on the selected option

I am working with the following code snippet: <!-- LANGUAGE --> <div class="languages_box"> <span class="red">Languages:</span> <a href="#" class="selected"><img src="../images/au.gif" alt="" title="" border="0" he ...

What is the reason behind the jQuery only functioning properly on Internet Explorer 8 on this particular page and no other browsers?

I recently created a webpage utilizing jQuery: The functionality on the page should change music images to represent different key signatures when switching from 'Higher Key' to 'Lower Key' in the combo box. While this works perfectly ...