Having trouble positioning the desired image at the bottom of the background using Tailwind CSS

I have been struggling to create a background with a video (z-index -2) and an image overlay (z-index -1). While I have managed to achieve this, I am having trouble getting the image to go all the way to the bottom where the footer is located. I am unsure about which CSS properties I need to make this happen.

I have spent several hours attempting to move it to the bottom without success.

https://i.sstatic.net/5fGxU.png

I am using create-react-app and tailwindcss

Background.js

import React from "react";

import BackgroundVideo from "./BackgroundVideo";

import testVideo from "../../media/videos/test_video.mp4";
import homeSkyline from "../../media/images/homeSkyline.png";
import BackgroundImage from "./BackgroundImage";

function Background() {
  return (
    <div className="fixed h-screen w-screen overflow-hidden">
      <BackgroundVideo video={testVideo} />
      <BackgroundImage image={homeSkyline} />
    </div>
  );
}

export default Background;

BackgroundImage.js

import React from "react";

// provides image and styling for Background
function BackgroundImage(props) {
  const { image } = props;

  return (
    <div className="relative z-negative1 h-screen w-screen">
      <img src={image} alt="" className=" min-w-10 inset-x-0 bottom-0" />
    </div>
  );
}

export default BackgroundImage;

BackgroundVideo.js

import React from "react";

// provides video for Background and styling
function BackgroundVideo(props) {
  const { video } = props;

  return (
    <video
      className="absolute z-negative1 min-h-none min-w-none max-w-3xl md:max-w-none"
      autoPlay
      loop
      muted
    >
      <source src={video} type="video/mp4" />
      Your browser does not support the video tag
    </video>
  );
}

export default BackgroundVideo;

App.js

import { BrowserRouter as Router, Switch, Route } from "react-router-dom";

import Home from "./pages/Home";
import Activities from "./pages/Activities";
import About from "./pages/About";
import Contact from "./pages/Contact";
import Book from "./pages/Book";

import Navbar from "./components/Navbar";
import Footer from "./components/Footer";
import Background from "./components/background/Background";

function App() {
  return (
    <div className="relative flex flex-col h-screen w-screen justify-between z-1">
      <Background />
      <Router>
        <Navbar />
        <Switch>
          <Route path="/" exact component={Home} />
          <Route path="/activities" exact component={Activities} />
          <Route path="/about" exact component={About} />
          <Route path="/book" exact component={Book} />
          <Route path="/contact" exact component={Contact} />
        </Switch>
        <Footer />
      </Router>
    </div>
  );
}

export default App;

Answer №1

Special thanks to Manjunath for providing the solution.

If you want to position a background image container at the bottom of the screen, you can achieve this by using flexbox and aligning items to the end of the container. This approach should work effectively – shared by Manjunath on May 6th at 5:54

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

Recursion using Node.js Promises

I'm facing some difficulties while iterating through my Promises and completing my parser code: let startFrom = 0, totalRecords = 10000, doneRecords = 0 const rows = 10 const parserRequests = function () { if (startFrom <= totalRecords) { ...

Mastering responsive layout design in Nextjs using Tailwind CSS

I am attempting to design a card layout where the image is on the left and the content of the card is on the right using flex in NEXTJS and Tailwind CSS. My goal is to ensure that the image remains responsive. <div className="block"> < ...

Guide to sending an array to a Node.js web service using AngularJS

Attempting to add an array of data to a Node.js web service using the code below. $scope.addList = function(task,subtask){ subtask.checked= !(subtask.checked); var data = { "taskId": task._id, "subTaskName": subtask.subTaskNa ...

What is the best way to pass my session token information between various JavaScript files on the server?

Here's the current status of my session tokens on the server: In my server.js file: app.use( session({ secret: "{ ...

issue with Firebase notifications not triggering in service worker for events (notification close and notification click)

I've been working on implementing web push notifications in my React app using Firebase. I've managed to display the notifications, but now I'm facing two challenges: 1. making the notification persist until interacted with (requireInteracti ...

Frozen Blanket: Modifying Particle Velocity

I need assistance adjusting the particle speed in this snowfall animation script. I'm having trouble locating the specific values that control the "Falling Speed." The current speed of the falling particles is too fast, and here is most of the code sn ...

I am facing an issue with updating my document in Node.js using MongoDB's bulkWrite

I am exploring the usage of MongoDB's bulkWrite feature for the first time. My goal is to update multiple documents by removing ids that match a specific filter criteria. I have learned that MongoDB's bulkWrite can facilitate this process. In my ...

Issue encountered during installation of react-masonry-css using npm

PS E:\Share me\shareme_frontend\my-project> npm install react-masonry-css npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfe ...

Discovering the CSS code for customization

As a beginner, I apologize in advance for any silly questions ˆˆ I am currently working on a website using bootstrap. Everything is functioning correctly, but I am struggling to override some CSS styles. In the image provided, you can see how I used the ...

Error detected in HTML table showing inaccurate data

My output seems to be missing the total marks for question 1 in the data insert for Total Marks. The marks for each question are as follows: Question 1: 3 Question 2: 5 Question 3: 2 The table currently shows incorrect answers, which can be viewed in thi ...

How can we limit the CSS properties that can be used in an interpolated manner by defining a restricted TS type for CSS props based on emotions?

When dealing with emotions, how can we specify a restricted TS type for the css prop to only allow certain css properties to be interpolated? For instance, consider the following scenario: // This is considered valid css = {{ color: 'white', ...

Echo result triggers a color change in the table cell

Working on a piece of code that should change the background color of the first td element based on ping results. If success, it becomes green; if failed, it turns red. The issue I'm facing is that while I can display images or use different methods ...

The error message "TypeError: render is not a function" is encountered when attempting to call and display information

I am currently working on a movie app using React JS and I encountered an error while trying to render a component based on API data. TypeError: Render is not a function The code works perfectly fine for TvListProvider, but I'm facing this error wi ...

unable to retrieve data from the local node.js server

When attempting to retrieve data from my local nodejs server, I encountered a strange error. The server I set up is a simple one using express. let express = require('express') let server = express() server.listen(3100) server.get("/", (req, res) ...

How can I retrieve properties from a superclass in Typescript/Phaser?

Within my parent class, I have inherited from Phaser.GameObjects.Container. This parent class contains a property called InformationPanel which is of a custom class. The container also has multiple children of type Container. I am attempting to access the ...

Invoke a PHP model function from JavaScript

I am looking to execute a php model function in an onclick attribute like shown below: HTML: <button id="my-button" onclick="setCookie()"></button> JS: function setCookie() { ... } PHP Model: Mage::getModel('core/cookie')-> ...

I'm experiencing issues with event.preventDefault() not functioning properly when used within a contenteditable div

I'm currently working with some basic Angular 7.x code that involves a contenteditable div. I'm attempting to prevent the default action when a user hits the [ENTER] key, but no matter what I do, it still moves the cursor to the next line. What a ...

Storybook/vue causing issues with aliases not functioning as intended

I'm currently utilizing Storybook for Vue and I am endeavoring to integrate aliases into the webpack config within storybook/main.js: resolve: { alias: { 'vue$': 'vue/dist/vue.esm.js', '@': path.resolve ...

I'm struggling to find the right Typescript syntax for defining a thunk function that returns a value while using React Redux Toolkit

Currently, I am utilizing TypeScript within a React Redux Toolkit project. While attempting to create an Async Thunk action function that is expected to return a boolean value, I found myself struggling with determining the correct TypeScript syntax: expor ...

Angular directive for concealing the 'ancestor' of an element

I have created a code snippet that effectively hides the 'grandparent' element of any '404' images on my webpage. Here is the code: function hideGrandparent(image){ image.parentNode.parentNode.style.display = 'none'; } < ...