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:

https://i.sstatic.net/c39K3.png

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

Unable to Upload File via API Routes in Next.js

I have encountered an issue while trying to upload a file to my server using the code provided below. Despite successfully uploading the file to the folder, I receive the following console output: API resolved without sending a response for /api/upload, ...

the quickest method to apply font-weight:bold; to the text within the component

Is there a way to apply font-weight: bold; only to the inner content of a component in a scss file while avoiding affecting the component tag itself? :host { font-weight: bold; } Although this code works, it also affects the component tag itself. What ...

Fetching JSON data from a GET request in Flask-Python is a straightforward process. By utilizing the

Currently, I am utilizing a GET request in my React app to execute a function that is only "printing" data from my Flask API. While I am able to hit the endpoint and receive a response, I am struggling with attaching the JSON data to the response returned ...

Migrating WordPress Gutenberg to a Separate React Component: Troubleshooting Missing CSS Styles

I am in the process of developing a standalone version of the Gutenberg block editor from Wordpress that can function independently outside of the Wordpress environment. My goal is to integrate the Gutenberg editor as a React component within an existing R ...

The Swig template displays the output tag prior to processing the content

Currently, I am developing an isomorphic React/Flux application and utilizing Swig for rendering the content. However, upon opening the site, a blank page briefly appears with the placeholder {{ html|safe }} output tag before displaying the actual content ...

How can I extract the page's output using JQuery?

Being a rookie in this area, I am eager to learn how to extract specific content from a page using AJAX in JQuery. Currently, I have been able to fetch the data of a page and display it as text: $.ajax({ type: "POST", url: "myfile.html", su ...

Airbnb PropTypes Array React Linter

My PropTypes look like this: SmartTable.propTypes = { name: React.PropTypes.string.isRequired, cols: React.PropTypes.array.isRequired, rows: React.PropTypes.array.isRequired, }; However, I am getting a linting error that says: The prop type "array" ...

Determine if the html element is wrapping to a new line when zoomed in or when the text size on Windows is increased

My webpage has 2 labels displayed side by side, but due to the system text size being set at 150% (which is recommended) in Windows, the second label does not have enough space and gets pushed below the first label. I am looking for a way to determine if t ...

Troubleshooting React.createElement warning in Jest, Enzyme, and Styled Components integration

After creating styled components in a separate file with the same name and .css.jsx, such as Abc.jsx having Abc.css.jsx and importing it to utilize in Abc.jsx, an error is encountered when attempting to test Abc.jsx using Enzyme mount. Warning: React.creat ...

Using a string as the key in a setState call in React: A beginner's guide

One challenge I'm facing involves calling a state value in React through a string. For example, if the string is "greeting" and the state value is greeting: "hello world", I encounter difficulties. When trying to call this.state.greeting using the st ...

"Kids with unlimited potential in the world of React Native development

I have developed a customized component called TabView, which encapsulates the functionality of ViewPagerAndroid (simplified version). class TabView extends Component { constructor(props){ super(props) this.state = { position: 0 } ...

The render function is returning an undefined value when called

I've spent the past two days trying to resolve a small issue in my React project (built with ViteJs, react-router, and Strapi backEnd), but I could really use some help! Here's the situation: I have an image gallery component with a specific str ...

The reason behind firebase-realtime-db getting stuck in an endless loop when updating

Having a simple code to update my firebase realtime database, I encountered an issue with the update() function causing an infinite loop at the line: return update(listsRef, updates): const HandleEditFormSubmit = (event) => { event.preventDefault( ...

The useEffect hook fails to update the useState flag, resulting in the flag remaining null whenever it is utilized

Greetings! I am currently in the process of developing an authentication application. To get started, I have created a login page and a DashBoardPage. Let's take a look at my login code. The functions handleSubmit and submit in my login page code are ...

Utilizing Dual Destructuring for Handling Undefined Main Objects

Before we proceed, I want to clarify that my question is not a duplicate of ES6 double destructure Let's examine the code snippet related to Apollo Client GraphQL: import { gql, useQuery, useMutation } from '@apollo/client'; ... const { loa ...

Achieving uniform height for child images within adaptable Bootstrap 4 columns. What's the secret?

I am looking to create 3 columns using Bootstrap 4 that will adjust their width dynamically while keeping the padding consistent. I also want to ensure that the height of each image in all three columns remains the same regardless of changes in page width. ...

What is the process for aligning a Component to the right within the Navbar in an AppLayout

In my project, the MainView class is an extension of an AppLayout. I am attempting to populate the Navbar with a logo on the left and the user ID on the right. Despite my efforts, both components keep aligning to the left side. Desired Navbar layout: ...

Do not apply styling to a particular page in CSS and HTML

Utilize the teachable.com platform and take advantage of their code Snippets feature (refer to attached photo #1) https://i.stack.imgur.com/dW1lB.png I inserted the following code: div { direction: rtl; } To modify the website's direction to be ...

Choosing between optional and required values in React-Syncfusion-RadioButton

Is there a way to make the yes radio button optional without requiring comments? Currently, the code looks like this. How can I make the value optional for yes and keep the no radio button as is? <Field component={RadioGroup} name=&qu ...

"Enhancing webpage dynamics with jQuery: Exploring the

I have a beginner's question regarding my jQuery script. The script I have makes the menu move slightly to the right. My first issue is that the <a> tag seems to be receiving bottom padding, and I am unsure why or how this is happening. My secon ...