`As the Screen Shrinks, Bootstrap 4 Jumbotron Text and Button Elements Fail to Resize Appropriately`

My current project involves using Bootstrap 4's Jumbotron to enhance the design of a landing page. Within the jumbotron, I have added standard headings and paragraphs along with two call-to-action buttons. To ensure proper positioning on desktop screens, I enclosed these elements in a div. However, upon resizing the window, the contents spill out of the jumbotron, disrupting the overall appearance of the page.

Below is how the layout appears on a desktop:

https://i.sstatic.net/AVziH.jpg And here is how it looks on "mobile":

https://i.sstatic.net/Ij9NS.jpg I hope the images provide a clear understanding of the issue. While the background image of the jumbotron adjusts responsively, the text and buttons overflow downward as the screen size decreases.

Here is the relevant HTML code snippet:

<div class="jumbotron jumbotron-fluid">
    <div class="jumboContents"> 
        <h1 class="display-3">Welcome to Other Mother!</h1>
        <p class="lead">Scroll Down To See Whats On Offer</p>
        <hr class="my-4">
        <p>Click Below To Start Shopping or Make a Request Instantly</p>
        <p class="lead">
            <a class="btn btn-info btn-lg" href="#" role="button">Shop Now</a>
            <a class="btn btn-info btn-lg" id="contactBtn" href="#" role="button">Contact OM</a>
        </p>
    </div>
</div>

Additionally, here is the relevant CSS code snippet:

.jumbotron {
    position: relative;
    top: -170px;
    height: 100vh;
    background-image: url(images/homepg.jpg);
    background-size: 100% 100%;
    margin: 0 auto;
    color: white;
    z-index: -1;
}

.jumboContents {
    position: relative;
    top: 30%;
    left: 30%;
}

Answer №1

For optimal stacking on smaller screens, I recommend utilizing the bootstrap grid classes within your divs. For example, you can use classes like "col-md-4 col-sm-1".

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

jQuery does not provide the reference of a basic canvas element

I'm having trouble with a simple initialization function that is supposed to create a canvas element in the body and save its reference in a variable. No matter what I try, jQuery doesn't seem to want to return the reference. I attempted refere ...

When you click on the "email" link, the Email app will automatically launch

Is there a way I can make the "EMAIL" text clickable in HTML, so that it automatically opens an email app or site and inserts the clicked email into the "To:" field? ...

Bootstrap 4 - positioning link element to align with heading in card header

I'm currently utilizing Bootstrap 4+ to design a card that features a collapsible card-body, triggered by a link located in the card-header. <div class="card text-left mb-3 mt-3"> <div class="card-header p-3"> <h4>Where should ...

Extract CSS using PHP

Currently facing a challenge with a project where I am receiving HTML files using CURL. The issue arises when images are set as background image in the CSS, as they do not load since the images are not on my server. This requires me to adjust the CSS to co ...

How can I align all the columns in every row to the left except for the first one?

To achieve the goal of making all columns except the first of a row in a table to have a text alignment of left (with the first column having a defined text alignment in CSS), the following code is utilized: <script type="text/javascript" src="../js/jq ...

Best practices for ensuring that your JS file properly interacts with content fetched via AJAX using jQuery

After seeking help for a code issue previously, I have come across another question. I recently watched an AJAX tutorial (https://www.youtube.com/watch?v=WwngGtboldU) to understand how to prevent specific sections of a website from loading. In the tutoria ...

Ensure that the second card within the card-columns structure occupies the entire available width

As a newcomer to Bootstrap (and web development in general), I am working towards achieving the desired effect shown in the image below: https://i.sstatic.net/tvBBo.png I have included part of my code snippet below: <div id="content" class="p-4"& ...

How can you effectively enhance images for optimal web performance? (Transitioning from Figma wireframe to code)

As I work on building my portfolio from scratch, one challenge I am facing is how to include high-quality images without sacrificing site speed or image resolution. I used Figma to create wireframes, but when I exported the images, I noticed a significant ...

What materials are required in order to receive messages and information through my Contact page?

Currently, I am pondering the optimal method for gathering information from my Contact page. I have already created a form; however, I'm unsure how to send the gathered data to myself since I am relatively new to Web development. Angular is the framew ...

Leveraging an AngularJS variable within an iframe

Is it possible to use a variable inside an iframe src or ng-src attribute? I've tried different variables but none seem to be recognized. For example: <iframe ng-src="http://www.example.com/?name={{test}}"> </iframe> The variable test ju ...

Is it a wise choice to implement frames in AngularJS?

I am in the process of developing an AngularJS application with a three-panel main view, resembling a mail system with a navigation bar on the left. The right pane is divided into two sections; selecting an item from the navigation bar populates the top-ri ...

How to horizontally center a div between two floated elements

Check out this JSFiddle example. I'm facing a challenge in horizontally centering the div class="filter-group" between two floated buttons within the given example. I've tried various methods but haven't been successful so far. Any assistan ...

Folded Corner Div using only CSS

I've been tirelessly experimenting with countless online methods, but I can't seem to make anything work. There's a div that needs to be flexible in width and height, positioned on a tile-able background image with a 1px border. The challe ...

Adjust the brightness of a specified oklch color by 50% using CSS oklch(from ...) in combination with the calc() function

We have implemented a design system that includes various CSS custom properties for colors. For example: :root { --color--blue-1: oklch(88.6% 0.023 238); } Our latest addition is the utilization of the oklch color format. Currently, I am tasked with ca ...

The duplication and multiplication of margin-left is occurring

I am baffled by the fact that margin-left is only affecting certain elements and causing frustration. .setting-container { position: relative; top: 60px; left: 0px; width: 100%; height: calc(100% - 60px); } .setting-topnav { width: 100%; h ...

Access a document located outside the public repository on Github

Having just launched a new webpage through Github pages, I've run into a slight issue. Due to the limitations of my unpaid account, my repository must remain public. While this is generally fine with me, I do have some .jpeg files that I prefer to kee ...

Chrome introduces surprise spacing to text input fields styled uniquely

This particular code snippet is functioning correctly on Firefox, but unfortunately not on Chrome. The height of the input should match the styling of the select, but there seems to be a discrepancy in Chrome. Any ideas on how to rectify this? Upon closer ...

Unable to reduce the height of the li element

Even though I've attempted to adjust the height of the lis in this section using CSS, I can't seem to shorten them as desired: I've experimented with setting a line-height, adjusting the height, ensuring that paddings and margins are set to ...

Create a sorting feature for a ListView that allows users to organize items by price in both ascending and descending order, as

view.py class HomeView(ListView): model = Item template_name = "home.html" paginate_by = 12 template <div class="header-dropdown"> <a href="#">A to Z</a> <div class="header-me ...

Applying CSS transitions and transforms to SVG elements

Having trouble animating an SVG group with CSS transitions after applying a CSS transform? Check out my code below and let me know if you spot the issue. Inline SVG Code <a href="javascript:void(0)" class="hub-icon-container"> <svg xmlns="ht ...