The CSS Flexbox text breaks free from its containing div

I want to ensure that the elements nav, #left, and #right always have the same height, with the text contained within each element and not overflowing.

<body>
    <header>
        Some text here
    </header>
    <main>
    <nav>
        Links go here
    </nav>
    <section id="content">
       <div id="headline">
            More Text
        </div>
         <div id="contentText">
            <div id="left">
                Left side content
            </div>
            <div id="right">
                Right side content
            </div>
        </div>
    </section>
    </main>
</body>

This is my CSS:

 header { 
        display: flex;
        height: 60px;
        width: 100%;
        background-color: green;
    }
    #logo{
        width: 15%;
        background-color: red;
    }
    #messages{
        width: 5%;
        background-color: yellow;
    }
    #notifications{
        width: 5%;
        background-color: red;
    }
    #search{
        width: 5%;
        background-color: yellow;
    }
    #searchArea{
        flex: 1;
        background: red;
    }
    #profileArea{
        width: 10%;
        background: yellow;
    }
    #options{
        width: 3%;
        background: red;
    }
    main{
        display: flex;
        width: 100%;
        height: calc(100% - 60px);
        min-height: calc(100% - 60px);
        background: blue;
    }
    nav { 
        width: 15%;
        min-height: 100%;
        background-color: green;
    }
    .link{
        width: 100%;
        height: 3%;
        background-color: yellow;
    }
    #content{
        display: flex;
        flex-direction: column;
        width: 85%;
        height: 100%;
        min-height: 100%;
        background: grey;
    }
    #headline{
        width: 100%;
        height: 5%;
        background-color: pink;
    }
    #contentText{
        display: flex;
        width: 100%;
        height: 95%;
        background: red;
    }
    #left{
        width: 50%;
        height: 100%;
        background: red;
    }
    #right{
        width: 50%;
        height: 100%;
        background: yellow;
    }

For more details, you can visit my JsFiddle page

Answer №1

Eliminate the specified height for #contentText

#contentText{
    display: flex;
    width: 100%;

    background: red;
}
main{
    display: flex;
    background: blue;
}
nav { 
    width: 15%;
    background-color: green;   
    overflow:auto;
}

Answer №2

To eliminate the height of #contentText, you must

#contentText{
    display: flex;
    width: 100%;
  /*height: 95%;*/
    background: red;
}

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

Maintain the center 1024px width while expanding the side columns to fit the entire page?

Is there a way to make the side divs extend to cover the entire page width? http://jsfiddle.net/p94vxnp2/1/ <style> #page_body_table { display: table; width: 100%; vertical-align: ...

Unable to execute jQuery animations on mobile devices when calling the function

I am experiencing an issue with a table that has a clickable option. Upon clicking this option, certain functions are supposed to run and alter the display of the page. The button code looks like this: <table id="topBar"> ... <td id="menuHead ...

Using jQuery UI to trigger Highlight/Error animations

Apologies if this question seems obvious, but I can't seem to find a clear answer anywhere... Is there a way to add a highlight/error message similar to the ones on the bottom right of this page: http://jqueryui.com/themeroller/ by simply using a jQu ...

Displaying checkboxes pulled from the database and saving any changes back to the database if they have been

Thank you for joining us today! I'm working with two tables in the database, Table1 and Table2, which have identical columns. My goal is to have an administrator review changes made in Table2 and use checkboxes next to each column to indicate which ch ...

Is there a way to position the text to the right and the image to the left?

I have written the following code: <!DOCTYPE html> <html> <head> <title>UMass Boston Computer Science Club About page</title> <link href='https://fonts.googleapis.com/css?family=Chakra Petch' rel='sty ...

Error: Unable to import Scss font file into Angular application

My font won't load and isn't displaying on the webpage. I've tried numerous solutions, but this stubborn font just won't show up. Appreciate any help in advance! fonts.scss : @font-face { font-family: Montserrat, sans-serif; src: u ...

Tips for correctly cloning a table row:

Currently, I am engaged with a Django project that involves incorporating a form within a table structure. <table name="mytable" id="table_purchase" role="grid"> <thead> <tr> <th class="text-center" hidden>No</th& ...

displaying information in table cells with jquery

Is there a way to display a table inside a td element with an on-click function without showing all tables in the same column when the function is triggered? I want the table to be shown only for the specific td that was clicked. $(document).ready(funct ...

What are the best techniques for showcasing rich text content in vue.js?

I'm working on a web application and attempting to showcase uploaded rich text content using vue.js. The content is generated by Action Text in the following format. <h1>text</h1><div>sample text<br><action-text-attachment ...

Seamless connection through Shopify's Buy Button

I have created a website using HTML5 and I am trying to create a direct link to a product checkout page without all the additional formatting and features that come with BuyButton. Shopify has provided me with this code: <div id='product-component ...

Choose a Vue filter according to the variable selected

My Current Table Dilemma Creating a table from a 2D array in Vue2 has been successful for me, as I've managed to display all the values correctly. However, I am facing issues with formatting. The template code is structured like this: <table> ...

The simple CSS command to change the background color using jQuery is not functioning properly in the Chrome browser

When it comes to conditionally changing the background-color of TDs based on a certain value, I've encountered some browser inconsistencies. The code snippet below works smoothly in IE and Firefox, but Chrome fails to display any color at all. I&apos ...

Ways to incorporate horizontal scrolling in mat autocomplete

I have an Angular app with auto complete functionality. I am trying to add horizontal scroll to the mat-option by applying CSS styles, but it's not working as expected. .cdk-overlay-pane { overflow-x: auto; } I also tried following the instruc ...

Why is it that my threshold for frustration in Bootstrap has been reached due to the ineffective grid system

It’s puzzling to me why my breakpoint is fixed at 800 px when I’ve specified it to be 991 (lg and lower) in Bootstrap 4. Here's the code snippet that I’m using: <div class="container-fluid"> <div class="row"> <div c ...

Is there a way I can automatically open all links in a new window after the first one?

After segregating controllers for my AngularJS app to handle hyperlinks opening in new windows successfully, I now face a challenge. I want to ensure that only one window opens for all new links instead of multiple windows. I suspect that using window.loc ...

Alteration of Content Height Input

I have designed a layout that I am excited to experiment with more in the future. Here is the current structure of my HTML: <!DOCTYPE html> <html> <head> <title>Title</title> <link rel="stylesheet" type="text/css" hre ...

The Alchemy feature on hover is not functioning

I am currently using alchemy.js to display a graph, but I am encountering issues with showing the "onMouseOver" caption of the graph's node. The console is displaying some errors which you can see here. Here is the code snippet: <html> < ...

React-Toastify revolutionizes the way styles are broken

For some time, I have been using react-toastify to show warnings. However, when I attempt to display the warnings now, it simply opens a page without any style and only the warning message. It looks like this: https://i.sstatic.net/HLNq2.png Is there a w ...

Retrieve the file name of the webpage from the URL bar

Is there a way to retrieve the page name from the address bar using jquery or javascript instead of PHP? I am working on an HTML website and would prefer not to use PHP for this specific task. For example, if the address is www.mywebsite.com/hello.htm, ho ...

Increasing the size of the entire page can be achieved using the three.js dom element

I am currently working on creating a 3D viewer using three.js. My goal is to have the viewer take up the full height of the screen while also leaving space for a side panel. The vertical layout is functioning properly, but once I add the render's dom ...