Having trouble getting the align-items-end property in Bootstrap 4 to function

After dedicating almost two full weeks to this project, I'm still struggling to achieve the desired outcome. I suspect that the issue may lie in the depth of the rows and columns I'm working with, but I'm open to any external perspectives or insights that could help me troubleshoot the problem.

Simply put, the page layout consists of 2 rows, with the second row containing 2 columns - the second of which holds 3 nested rows including a breadcrumb, the main content of each page, and a footer. The challenge I'm facing is ensuring that the navigation bar remains fixed when the page extends. I vaguely remember stumbling upon similar layout attempts at the beginning of my project, but unfortunately, I haven't been able to locate those resources again.

Provided below is the pared-down code snippet that's causing the issue:

<!DOCTYPE html>
<html lang="en">
    <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

        <!-- Bootstrap and self-made CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">       

        <!-- various imports -->
        <link href="https://fonts.googleapis.com/css?family=Chivo:900" rel="stylesheet">
        <style>
        html, body{
            height: 100%;
            width: 100%;
        }
        h2 {
            font-family: 'Chivo', sans-serif;
        }
        </style>
    </head> 
    <body  style="background-color:  #000;"> <!-- bgc: black -->
    <div class="container-fluid h-100">
        <div class="row h-25"style="background-color:  #F00;"> <!-- bgc: red -->
            <div class="col">
                <h1>In the header!</h1>
            </div>
        </div>
        <div class="row h-75" style="background-color:  #0F0;"> <!-- bgc: green -->
            <div class="col-sm-2 no-gutters h-100" style="background-color:  #00F;"> <!-- bgc: blue -->
                <nav>
                    <h2>In the nav bar!</h2>
                </nav>
            </div>

            <div class="col-sm-10 no-gutters h-100" style="background-color:  #FF0;"> <!-- bgc: yellow --> 
                <div class="row align-items-start" style="background-color:  #FFF;"> <!-- bgc: white -->
                    <div class="col">
                        <main>
                            <h2>In the breadcrumb!</h2>
                        </main>
                    </div>
                </div>
                <div class="row align-items-center" style="background-color:  #0FF;"> <!-- bgc: cyan -->
                    <div class="col">
                        <main>
                            <h2>In the main!</h2>
                        </main>
                    </div>
                </div>
                <div class="row align-items-end" style="background-color:  #F0F;"> <!-- bgc: magenta -->
                    <div class="col">
                        <footer>
                            <h2>In the footer</h2>
                        </footer>
                    </div>
                </div>
            </div>
        </div>
    </div>  
        <!-- Optional JavaScript -->
        <!-- jQuery first, then Popper.js, then Bootstrap JS -->
        <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
    </body>
</html>

If you've encountered a similar layout challenge, could you kindly provide some guidance to address the following questions:
1. Is it feasible to create this layout using Bootstrap 4?
2. What modifications are required to achieve the desired outcome?
3. I'm facing an issue where the "nav column" doesn't collapse as intended on smaller screens, remaining at full height. Am I utilizing the correct subclasses for fluid scaling?

Answer №1

Unfortunately, I don't have much experience utilizing rows and containers in Bootstrap 4. However, I am able to offer a flexbox implementation for a similar layout. If you are familiar with flexbox, you can use the following code as a guide to construct your desired layout.

Below is a basic flexbox code snippet to achieve the structure you described. While it may not be the most comprehensive solution, I hope it can still be of assistance.

<div class="container-fluid d-flex flex-column" style="height: 100%"> <!-- Main container set as a flexbox column -->

    <div class="h-25"> <!-- First row within the container -->
    </div>

    <div class="h-75 d-flex row"> <!-- Second row within the container. This itself is a flexbox row -->

        <div class="col-sm-2"> <!-- First column of the row -->
        </div>

        <div class="col-sm-10 d-flex flex-column"> <!-- Second column of the row -->

            <div> <!-- First sub-row of the column -->
            </div>

            <div> <!-- Second sub-row of the column -->
            </div>

            <div> <!-- Third sub-row of the column -->
            </div>

        </div>

    </div>

</div>

For a better understanding of flexbox, refer to the Bootstrap 4 flexbox documentation here.

UPDATE

Here is a functional Plunker showcasing the code: https://plnkr.co/edit/WWT5XoHyvLf2paKQItSH?p=preview

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

I seem to be having trouble getting my style to work properly with Material UI's makeStyles

I am experiencing an issue with Material-UI makeStyles not working properly. I am trying to apply my CSS style but it doesn't seem to be taking effect. I suspect that Bootstrap or MaterialTable might be causing this problem. While Bootstrap4 works fin ...

Issues with implementing the Skeleton feature in the Alert module

Having an issue with a Skeleton component not taking full width inside an Alert component. It seems to be occupying less space than expected. https://i.stack.imgur.com/cMLEy.png Here is the relevant code snippet: <Alert icon={<NotificationsIcon s ...

Issue with Error in Expanding Label in Material-Ui using React

I have managed to increase the size of the Label in the TextField component of my React application. However, I am encountering an issue where it overlaps some text on its right when it shrinks. https://i.sstatic.net/BikHJ.png Here is the link for refere ...

The various sections of my website are neatly tucked away under one tab, only revealing themselves to users as they click on each individual tab

My recently published website is experiencing a strange issue. When the site loads, all contents including paragraphs and videos from other pages are displayed under one tab (the HOME tab). However, once any other tab is clicked, the issue fixes itself. Yo ...

Can you explain the distinction between angular input and native HTML attributes when used with HTML tags?

Take the input tag as an example, where you have two options to specify a maximum length: <input [maxLength]="20" type="text"> <input maxLength="20" type="text"> Are there any real-world distinctions between using one approach over the othe ...

Ensure the padding and margin are both set to 0 when using inline styles

As someone who is not a designer, I attempted to send an email from PHP. In order to do so, I took a template and converted all styles to inline. However, I am unsure of where to include the universal margin and padding style in the template. *{margin:0px ...

What is the best way to generate a complete PDF of a webpage using pdfmake?

I'm currently developing a web application and facing the task of converting an HTML page, which contains multiple tables and datatables, to a PDF format. To achieve this, I've chosen to utilize the library pdfmake. Below is the script that I ha ...

Flameflare/Console-inspired hover animation

Curious if there is a creative solution to this problem that I haven't thought of yet... I'm working on a site editor tool and it would be incredibly useful to have the ability to highlight elements when hovering over their code in the html/elem ...

Prevent the parent component's ripple effect from being activated by the child component

If I have a simple code snippet like the following: <ListItem button={true} > <Typography variant='caption' color='primary'> {value} </Typography> <Button onClick={foo} > Button ...

Choosing the middle child of an element without using the :nth pseudo-classes

As I gear up for a regional championship in web development for high school students, one of the preparation tasks involves solving challenges on the championship website. The HTML code provided is as follows: <h2>Task 6</h2> <article id=& ...

Error message in JS/Ajax alert box

I keep receiving an alert box saying "Image uploaded" even when the variable $imagename is empty. Below is the script in question: <script> function ajax_post1(ca){ var cat = ca; var name = document.getElementById("name").value; var ...

Acquiring inner HTML content with PHP

Looking to optimize meta tags for search and open graph. My goal is to dynamically generate the meta description tag by combining content from two specific elements in the HTML. For instance, let's say we have this snippet of code: <div class="r ...

Maximizing the width of an absolute div element inside a container

Looking at this demo, you'll notice that the header remains fixed. However, my issue lies in getting the absolute <div> inside the <th> to occupy 100% of the width of the <th> When I set width: 100% for the <div>, it expands t ...

Harnessing the power of Selenium to locate an anchor tag containing HTML elements with specific classes

I have a specific element on my webpage that I need to extract the text "Add New Member" using Selenium. Here is the HTML code for the element: <a ng-if="userCanEdit" class="btn btn-primary ng-scope" ui-sref="orgs-add" href="#/orgs/add"> <i& ...

Utilizing the identical modal for Add/Edit functionality within AngularJS

Recently, I started working with AngularJS and I am in the process of creating a simple project that involves creating, reading, updating, and deleting countries. The code is functioning correctly overall. However, I have encountered an issue regarding th ...

What is the reason for the request to accept */* when the browser is seeking a JavaScript file?

The html source appears as follows: <script type="text/javascript" language="JavaScript" src="myscript.js"></script> Upon debugging the http request using Fiddler, it is evident that the browser (Chrome) sends a GET request for myscript.js wi ...

Choosing radio buttons within rows that contain two radio buttons using ngFor

This section showcases HTML code to demonstrate how I am iterating over an array of objects. <div class="row" *ngFor="let item of modules; let i = index;"> <div class="col-md-1 align-center">{{i+1}}</div> <div class="col-md- ...

Using jquery and Ajax to extract data from nested JSON structures

Need help with modifying a code snippet for parsing nested JSON format [ { "name":"Barot Bellingham", "shortname":"Barot_Bellingham", "reknown":"Royal Academy of Painting and Sculpture", "bio":"Barot has just finished his final year at T ...

Trigger a click event to alter the child div elements

I have a <div> that expands when clicked and shrinks back when clicked again. Inside this div are images that should only appear once the div expands. My issue is ensuring that all images except the first one are hidden until the div expands. https: ...

What is causing the newly generated input tags to disappear from the page?

I'm having an issue where my code successfully creates new input tags based on user input, but they disappear shortly after being generated. What could be causing this to happen? <form> <input type='text' id='input' /> ...