Achieving 100% height with Flexbox in CSS

In my layout, I have a column on the right with <IndustryList />, and I want everything in the other <div> that contains <ParameterAndPostSearch /> and <SocialPostList /> to extend to the bottom. However, no matter what I try, setting height: 100% doesn't make it extend all the way down. Here is an image for reference:

Here's an excerpt from the relevant Component code in ReactJS: I've simplified everything for clarity, and I'm using Tachyons CSS for styling.

render() {
    return (
        <div className='flex'>
            <div className='flex fixed width-235-px height-100'>
                <IndustryList />
            </div>
            <div className='margin-L-235px height-100'> // this height isn't taking effect
                <div className=''>
                    <ParameterAndPostSearch />
                </div>
                <div className='flex'>
                    <SocialPostList />
                </div>
            </div>
        </div>
    )
}

The <SocialPostList /> component structure:

return (
    <div className='flex'>
        <div className='flex-auto'>
            <h4>Available Parameters:</h4>
            <PostListArray />
            {this.props.allSocialPostsQuery.allSocialPosts.map((socialPost, index) => (
                <SocialPost />
            ))}
            <div>
                <form>
                    <input />
                </form>
                <button>Submit</button>
            </div>
        </div>
        <div className='background-black width-350-px height-100'>

        </div>
    </div>
)

Update: I have resolved the issue... I realized that having fixed and absolute positioning was causing unwanted scrollbars. Additionally, studying and mimicking the flexbox layout demonstrated in this example helped me a lot in fixing the layout. It took some time but now everything works as intended.

Answer №1

Although I haven't personally used Tachyon CSS, the documentation provides a clear explanation of its features:

/* Height Percentages - Relative to parent's height */
.h-25 { height: 25%; }
.h-50 { height: 50%; }
.h-75 { height: 75%; }
.h-100 { height: 100%; }
.min-h-100 { min-height: 100%; }

/* Viewport Height Percentage */
.vh-25 { height: 25vh; }
.vh-50 { height: 50vh; }
.vh-75 { height: 75vh; }
.vh-100 { height: 100vh; }

Remember to ensure that every parent element is set to 100%, with no padding or margin applied.

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

Align the reposition button with the pagination in the datatables

I am looking to adjust the placement of my buttons. The buttons in question are for comparison, saving layout, and printing. I would like them to be inline with the pagination, as I am using datatables here. <table id="sparepart_id" cellspacing="0" ...

How to show a placeholder in a select input using ReactJS

I'm currently trying to incorporate placeholder text into a select input field using ReactJS, but it doesn't seem to be working as intended. Here is the code snippet I am working with: <Input type="select" placeholder="placeholder"> ...

A simple guide on how to display a child object in a materialUI select dropdown from a parent object

I am developing a ReactJS application where I aim to showcase child objects from the parent object in a dropdown using materialUI select. Despite attempting to iterate over the object using the map() function, I haven't been able to retrieve values up ...

Comparison between Box and Stack components in Material-UI

As I delve into my latest project using MUI with React, I have encountered two layout components that have me scratching my head – Stack and Box. When is it best to opt for a Stack over a Box? I have familiarized myself with the purpose of a box compon ...

How to enhance the animation of the Material-UI right side persistent drawer

I am currently working on a sophisticated application that includes several drawers. Specifically, I am encountering an issue with the animations of the right side drawer. While the drawers animate correctly, the parent divs do not seem to follow suit. Eve ...

Is there a glitch preventing the connection between HTML and CSS in Notepad++ even though the link is correct?

I have encountered a puzzling situation that has left me scratching my head in confusion. Despite being a rookie, I've had experience with linking CSS files before and can't understand why it's not working this time around. This issue is per ...

Having trouble with react-testing-library and material-ui: Invalid element type error?

I encountered an issue while attempting to render a component in a react unit test, specifically with the mount method using enzyme. The error message is: Element type is invalid: expected a string (for built-in components) or a class/function (for comp ...

Utilizing Material-UI Table in a class component with tailored pagination functionalities

Is there a way to implement the MATERIAL-UI table on a class component? Most tutorials and official documentation show it as a functional component, leading to difficulties when dealing with react hooks in a class component. I am looking for guidance on h ...

Difficulty with font rendering across different web browsers such as Firefox, Chrome, and Opera

Visit the following website: I have implemented font-face on my site: @font-face { font-family: 'SegoeUI'; src: url('{site_url}themes/site_themes/agile_records/fonts/segoeui.eot?') format('eot'), url(' ...

Tips for integrating elements within React Components to create a Container-like structure

I am looking to create a component similar to the following: class MyContainer extends React.Component { render(){ return <div width="1000">{xxx }</div> } } and it should be used in this way: <MyContainer><xxx>&l ...

Retrieve the width of an element once the browser has finalized its dimensions

I am facing an issue with centering a pop-up box perfectly within the window using CSS properties. The code for the pop-up box styling is as follows: #pop_up { position: fixed; display: inline-block; border: 2px solid green; box-shadow: 0p ...

Using a declared const in a separate React file

I've been searching for a solution, but haven't found anything that helps. I'm trying to retrieve data from an API and pass it to another page. The information is currently defined as "drink.strDrink", including the name and image. However ...

Bootstrap card elements are failing to display properly, deviating from the expected

My Bootstrap cards are displaying strangely. Instead of having a border, white padding, and a white background like the examples I've seen, mine look like plain text without any styling. Here is an image for reference: https://i.stack.imgur.com/9MsP ...

Eliminate viewed alerts by implementing a scrolling feature with the help of Jquery, Javascript, and PHP

My goal is to clear or remove notifications based on user scrolling. The idea is to clear the notification once the user has seen it, specifically in a pop-up window for notifications. I am relatively new to Javascript/jQuery and feeling a bit confused abo ...

Mastering image focus with javascript: A comprehensive guide

On my HTML page, I have two images and a textbox. I want the focus to shift between the images based on the first character entered in the textbox. For example, when the user types '3', the first image should be focused, and for '4', th ...

Using a Custom Material-ui button in a React application for repeated use

I am currently working on my first React application. I have successfully imported a Material-ui button and customized it to my liking. Now, I would like to use this custom button in multiple components within my app, each time with different text. Where ...

Conceal a component when the succeeding one appears on a separate line

I'm looking for a solution to display an address on a webpage in two different formats based on the length. The first format should be: Street Number, PostalCode City If the address is too long to fit on one line, it should be displayed as: Street ...

CSS animation for input range slider

Is there a way to create smoother animations for the input[type="range"] element, especially when dealing with short audio files? You can check out my Codepen where I've been experimenting with solutions using a short audio file: Codepen Link I am s ...

In PowerShell, use the "ConvertTo-Html" commandlet to incorporate

I have a script that retrieves data from a server, converts it to HTML, and then sends the report via email. Here is a snippet of the script: $sourceFile = "log.log" $targetFile = "log.html" $file = Get-Content $sourceFile $fileLine = @() foreach ($Line i ...

The function within the Context Hook has not been invoked

My attempt to implement a signin method using the context hook is not working as expected inside the AuthContext file. When calling the signin method from the Home Page, neither the console.log nor the setUser functions are being executed inside the AuthC ...