Prevent parent block from getting filled with children

As I delve into the world of coding with bootstrap, I've encountered a peculiar issue. My goal is to create a simple template comprising a title row and a middle row. The middle row should have a grey background with white content in the center. Additionally, I want the background colors to expand throughout the row irrespective of the content size.

However, I'm facing an overflow problem when the content within the middle row becomes too large, and I can't seem to pinpoint the cause of this issue.

Below is the code snippet I'm currently working with:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Potatoe Home</title>
        <link rel="stylesheet" href="path/to/file/file.css" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
        <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    </head>
    <body class = "container-fluid">
        <div class = "row titleRow">
            <div class = "col-sm-3">
            </div>
            <div class = "col-sm-6">
                <div id="titleArea">
                    <h1 id="title">Potatoe</h1>
                    <p>blablabla</p>
                </div>
            </div>
            <div class = "col-sm-3">
            </div>
        </div>
        <div class = "row scndRow">
            <div class = "col-sm-3">
            </div>
            <div class = "col-sm-6 middleColumn">
                <div id="testBlock">
                </div>
            </div>
            <div class = "col-sm-3">
        </div>
    </body>
</html>

My CSS styling for this setup is as follows:

h1[id=title]
{
    font-size: 200%;    
}

.titleRow
{
    background-color: red;
    color: white;
    font-size: 200%;
}

.scndRow
{
    flex-grow: 1;
    display: flex;
    background-color: #D0D0D0;
}

.middleColumn
{
    background-color: white;
}

#testBlock
{
    width: 20%;
    height: 900px;
    background-color: blue;
}

html, body
{
    height: 100%;
}

body
{
    display: flex;
    flex-direction: column;
}

If you'd like to see how my page is displaying, you can take a look here.

Thank you in advance for any assistance or insights you can provide.

Answer №1

The issue has been successfully resolved: I have now replaced the height: 100% with min-height: 100% (for html and body).

By setting a height: 100%, Chrome interprets it as wanting to be 100% of the viewport. When my testBlock is larger, it should expand the row and subsequently the body. This would result in the body's height being greater than 100%, leading to overflow issues in the testBlock.

Thank you for your assistance :)

Answer №2

Is it possible to remove the flex properties from the scndRow class?
and instead, set height:100% to the necessary element?

You need to specify this in the scndRow class, which wraps the other two column classes as well as those columns.

.scndRow{
  height:100%;
}

.scndRow .col-sm-3
{
    /*flex-grow: 1;*/
    /*display: flex;*/
    min-height:100%;
    background-color: #D0D0D0;
}

.middleColumn
{
    min-height:100%;
    background-color: white;
}

As an illustrative example, I have included a jQuery function to demonstrate how adding more content affects the testBlock.

Check out the changes in the updated Fiddle

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

How can you modify the Bootstrap class of a grid item only when the grid collapses in Bootstrap 4?

Is there a way to dynamically adjust the bootstrap class of a grid element from col-md-9 to col-md-12 only when the grid breaks due to resizing the browser window? For example, consider the following code snippet: https://jsfiddle.net/kp41m0xq/ <body ...

HTML5 Video validation is not working properly

In my current project, I initially used embedded Youtube videos but faced issues with validation. Decided to explore HTML5 video elements as an alternative, but encountered some challenges. While attempting to validate the code, strange errors popped up: ...

Ways to center items within a column using Bootstrap

I'm working on a React project with Bootstrap and I'm trying to align the contents of my second column to the bottom. However, everything I've tried so far hasn't been successful. I've seen others achieve this layout but for some r ...

Webstorm encounters difficulties compiling Sass

While attempting to utilize Sass in the Webstorm IDE, I noticed that it is defaulting to Ruby 1.8 (OS Default) instead of my preferred RVM Ruby Version (1.9.x). To address this issue, I tried setting the path for Sass in the Watcher-Configuration: PATH=$ ...

Filling out a JSP form using Java code

Looking for a way to populate a 'Form' in a JSP page based on Java results. This is the Javascript code I am using: $('#uSystemList').change(function() { $.get("/live-application/systemById", {systemid: $("#uSystemList").val()}, d ...

Having difficulties in dynamically swapping audio sources using JavaScript?

It seems like I'm overlooking something simple here. The issue I'm facing involves creating a series of buttons with different audio sources as titles. When a user clicks on a button, the corresponding source should update in the audio player. T ...

How can I create a CSS animation for a box element?

During my current project, I have the task of creating a box that will display an animation within 2 seconds and move from one corner to another. What is the most straightforward way to achieve this? ...

Creating vertical lines that extend the full height of a webpage: Frontend techniques

My goal is quite straightforward and you may have come across it on other websites before. I want to create thin lines (1px) that match the column borders and extend from the top to the bottom of the page. These lines should always be visible and on top o ...

A guide on sending requests for multipart files using Ajax

This inquiry has been explored multiple times, yet despite attempting various suggestions, I am still unable to get it to function correctly. Essentially, I have an HTML form that initiates a POST multipart file request to the server upon submission: < ...

Retrieve information using Angular's EventEmitter

Recently I started learning Angular and encountered a challenging issue that has kept me occupied for the past few hours. I have implemented a parent-child relationship between two components, with a need to share a boolean variable from the parent to the ...

The padding on the left and right sides does not seem to be functioning properly on the menu links

Whenever I hover over the links on my menu, underlines slide in and out. However, I am facing an issue where the padding I added to the left and right of the links is not displaying correctly. Here is a visual representation of what I am trying to achieve ...

Overcoming Challenges with Ajax Success in Bootstrap DataTable Modal

Recently, I created a webpage featuring a top fixed navbar and a CRUD datatable with pagination supported by buttons that trigger modals. However, I'm encountering an issue where upon clicking the delete button in the modal to remove a record, the mod ...

Create columns with responsive layouts that can accommodate multiple groups of images and paragraphs

Multiple divs with images and another group of divs containing p tags (only numbers) come together to create an odontogram. This structure, consisting of a set of teeth along with their corresponding numbers, fits within a column that is 8 units long. More ...

Creating distinctive HTML identifiers with a PHP loop

Hi everyone, I'm a newcomer to form creation and I'm excited to hear all of your insights. Currently, I'm working on a small website and I've encountered an issue with generating unique HTML ids. I am using a loop in PHP to generate th ...

Gathering data from an HTML table along with the corresponding href links using R

My goal is to download a table that includes both text and links. I have managed to download the table using the link text "Pass", but now I want to capture the actual href URL instead of the text. library(dplyr) library(rvest) library(XML) library(httr) ...

Toggling CSS in Vue with a button and a checkbox

I'm currently working with VueJS and here is the CSS code I have: .button-css { align-items: center; background-color: var(--azure-radiance); border-radius: 30px; display: flex; height: 50px; min-width: 200px; padding: 0 60px; } .opensans-bold ...

How can jQuery be utilized to enlarge specific <li> elements that are aligned with the right side of the page?

I'm encountering issues with expanding list elements using jQuery. The lists consist of social media icon links that I would like to enlarge upon mouseover. The problem arises when enlarging the width of the li element, causing the ul to also expand. ...

The communication between a Firefox XUL extension and a webpage

Currently developing a Firefox XUL extension and in need of incorporating interaction between the web page and the extension. For instance, whenever a link is clicked on the page, I would like to trigger a function within the XUL extension. Is there any k ...

Error: Syntax error detected. Unexpected blank space found. Expecting either "-" symbol, identifier, or variable

Error: Syntax error: unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\Source Code\displaysalesdetailed.php on line ...

Reverting button highlighting when another button is selected in Web development using CSS and Bootstrap

On my signup page, I have two buttons that control the display of corresponding containers. However, I encountered an issue where clicking a button changes its background color and keeps it changed even after selecting the other button. If I click the same ...