The fluid jumbotron in react-bootstrap is not extending to the entire width of the webpage

For the past few days, I've been engrossed in working on a website to sharpen my React skills using create-react-app, react-bootstrap, and styled-components. Initially, everything was smooth sailing with the jumbotron when it resided in my App.js file. However, the real challenge began when I decided to relocate it to my Home.js file so that it only appears on the home page. No matter what I try, I can't seem to get it to span the width of the page, despite being a fluid jumbotron.

My struggles are evident in the code snippet below from my Home.js file where I'm attempting various methods to style the Jumbotron element. Even configuring it as a separate component that I import doesn't yield the desired result. Any ideas or suggestions?

import React from 'react'
import styled from 'styled-components'
import ReactDOM from 'react-dom';
import {SocialMediaIconsReact} from 'social-media-icons-react';
import { Container } from 'react-bootstrap';
import { Jumbotron as Jumbo } from 'react-bootstrap'
import coffeeImage from './assets/coffee.jpg';

// Styled component styles for Jumbotron
const Styled = styled.div`

        .container {
            max-width: 100%;
        }

        .jumbo {
            background: url(${coffeeImage}) no-repeat fixed bottom;
            background-size: cover;
            color: #efefef;
            height: 800px; 
            width: 100%;
            right: 30%;
            position: relative;
            z-index: -2;
            margin: 20px;
        }

        .overlay {
            background-color: #000;
            opacity: 0.2;
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            z-index: -1;
        }

        .title {
            font-family: Amatic SC;
            font-size: 120px;
            position: relative;
            right: 30%;
            top: 80px;
        }

        .slogan {
            font-family: Dosis;
            font-size: 50px;
            position: relative;
            top: 80px;
        }

    .homeHeader {
        font-family: Dosis;
        font-size: 4em;
        text-align: center;

    }

    .homeText {
        position: relative;
        padding-top: 50px;
    }

    .container {
        width: 350px;
        height: 50px;
        align-content: center;
    }

    a {
        padding: 10px;
    }


`;

export default function Home() {
    return (
       
        <Styled>
            <Jumbo fluid className="jumbo">
                <div className="overlay"></div>
                <h1 className="title">Sorta Sunny Coffee</h1>
                <p className="slogan">Drink in the sun!</p>
            </Jumbo>
            <Container>
                <SocialMediaIconsReact icon="twitter" url="/" iconSize="3"/>
                <SocialMediaIconsReact icon="snapchat" url="/"/>
                <SocialMediaIconsReact icon="facebook" url="/"/>
                <SocialMediaIconsReact icon="youtube" url="/"/>
                <SocialMediaIconsReact icon="instagram" url="/"/>

            </Container>
        </Styled>
    )
}

Answer №1

After reviewing your CSS, I have implemented some modifications that could potentially improve the design...

Click here to view in sandbox

Answer №2

It appears that your constant Styled has two instances of .container. You may want to review that section.

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

Unique validation feature implemented in Parsley.js runs through validation loop twice

I've spent the entire afternoon trying to figure this out, but I just can't seem to debug it. The issue arises when I do a hard refresh of the page and my custom async validator runs twice, yet only sends one request to the server. window.Parsle ...

How to retrieve the present value from an array using AngularJS

Struggling to assign the current user from my list Here is my array after submitting the form [{"name":"Erich","surname":"Josh","email":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="096c67497a7a276a6664">[email prot ...

Loading animation reminiscent of a whirlpool, similar to the movement

In my quest for the perfect animation, I have scoured far and wide. Unfortunately, the one I found at http://jsfiddle.net/pedox/yed68/embedded/result/ is created using css, which many browsers do not yet support fully. I also explored , but found it to be ...

Steps for modifying the color of the downward arrow in a text field using Material UI

I'm looking to change the color of an arrow down icon when hovering or selecting a textfield. Here is my textfield and its current styling: Style const styles = theme => ({ icon: { fill: themeStyle.textColor, }, underline ...

Issue with Jquery Fancybox shadow rendering on older versions of Internet Explorer (IE7/IE8

Take a look at this demo page: Notice that the popup has a shadow around it in most browsers, but not in IE7/IE8. I'm seeking advice on how to make the shadow appear in those browsers as well. Any suggestions? ...

Failed to successfully sort several distinct lists using the ng2-dnd sorting library

Recently, I came across a fantastic drag-and-drop library on GitHub that I decided to use. In my current project, I have created a view with three different buttons, each revealing a list when clicked at the same position but not simultaneously. However, ...

Error occurred while attempting to execute the method

Here's a MongoDB Mongoose query we're dealing with: sampleSchema.find({ $where: "expired <= " + (new Date()) }) .limit(9) // Problems may arise from here .sort({ postedDate: -1 }) .then((docs) => { console.log(&apos ...

Ways to customize the appearance of CSS bootstrap 'col' elements?

I'm attempting to customize the styling of bootstrap CSS columns col-xl in order to display 5 or 6 cards/tiles on my webpage instead of just 4 (refer to attached image) without interfering with the other grid layouts. Unfortunately, I am currently str ...

Is there a way to access fields from an associated model within React components?

Is there a way to access fields from an associated model in React components within Rails? I have a listing model that I'm iterating through in a React component and retrieving all the fields for each record, including the ID of the associated model. ...

Creating a Select Directory feature with React - A Step-by-Step Guide

I am in need of uploading all files from a folder to the server. I have been attempting to use a Select Directory window instead of selecting individual files. The standard method: <input type="file" webkitdirectory directory/> has not worked for ...

I have been tirelessly attempting to resolve this issue, yet all my efforts have proven futile thus

Encountering an issue with web packs and nextjs. import NextDocument, { Html, Head, Main, NextScript } from 'next/document' import theme from '../libs/theme.js' export default class Document extends NextDocument { render() { retu ...

Using Angular to display exclusively the selected items from a list of checkboxes

Is there a way to display only the checked items in a checkbox list? I am looking for a functionality where I can select multiple items from a checkbox list and then have an option to show only the selected items when needed, toggling between showing just ...

Transferring information from Vue Component to Vuex storage

I am currently working with a Laravel API route that looks like this: Route::get('c/maintenances/{contractor_user_id}', 'Maintenance\Api\ApiContractorMaintenanceController@index'); The contractor_user_id parameter is dynamic ...

The ZIP file downloaded from NodeJS is corrupted and cannot be opened

Currently, I am utilizing the following code to create a MySQL dump in memory, then zip that SQL file with a password from memory and save it to the hard drive so it can be streamed to the client... /* DUMP - database */ var mysqld ...

Tips for Accessing the TextInput Content in React Native

My code is currently experiencing a bug where I am getting an undefined object type when trying to console log user input. Below is the code snippet I am working with. Can you help me identify and correct the issue? export default function App() { con ...

Issue with Mjpg paparazzo.js functionality not functioning as expected

I am currently exploring alternative methods to view my security cameras without relying on browser support for mjpg streaming. I have come across Paparazzo.js, which appears to be a promising solution that I want to experiment with: https://github.com/rod ...

Utilize JavaScript and PHP to dynamically modify the contents of an HTML file

After not receiving a satisfactory answer to my question yesterday, I decided to find a solution. However, I am now facing an issue with the new program and unsure of the mistake. The program involves retrieving the contents of announcement.html and displ ...

Adding custom fields to the user model in MongoDB using Next Auth during login is not possible

When a user logs in via next auth, I am looking to include custom fields to the default user model. I followed the instructions provided in the official documentation at https://next-auth.js.org/tutorials/typeorm-custom-models. Here is the code snippet: ...

Challenging z-index problem arising between mobile menu and dynamic animations

I'm facing a unique challenge on my website related to the z-index. The content's z-index is lower but somehow appears above the menus (z-index: 4;) on mobile or resized browsers. To understand this issue better, let's delve into the CSS beh ...

Tips for comparing array objects in two separate React states

Comparing object arrays in two different React states can be challenging. Here is an example of the state values: review1 = [{name: John, Title: Manager},{name: Peter, Title: Engineer}, {name: Serena, Title: Supervisor}] review2 = [{personName: John, isma ...