What is the best way to achieve two columns of the same height, with the right column nested inside the left column?

Is there a way to create two equal height columns with the right column inside the left column using pure CSS? I have explored different methods, but due to the lack of a parent selector in CSS, I haven't been successful so far.

My goal is to have expandable divs where collapsing the left column hides the right column. While I had achieved this functionality with JavaScript before, I am now searching for a CSS-only solution. Placing the right column inside the left column seems like a potential workaround, as absolute positioning won't work in this scenario.

Furthermore, both columns should adjust their height based on the content of the larger column.

<div class="container">
    <div class="left-column">
        ssss
        dddd<br/>
        ffff<br/>
        ddd
        <div class="right-column">
            fffff
        </div>
    </div>
</div>

.container
{
    height:100%;
}

.left-column
{
    background-color:blue;
    width:50%;
}

.right-column
{
    background-color:red;
    width:100%;
    position:relative;
    left:100%;
}

Check out the code example here

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

Ensure that the collapsing toggler and the textbox are aligned on the same line

As part of my project, I am developing a bootstrap5 website that features a search form. I am facing an issue where I am unable to align the form text box labeled "search by country" vertically on the same line as the collapsible hamburger toggler. I hav ...

Looking for assistance with troubleshooting CSS issues specifically in Internet Explorer

Hey there! I've been working on a landing page and it's looking good in Safari, Firefox, and Chrome. The only issue is that the layout is all messed up in IE (any version). If any of you experts could take a look at it and give me some suggesti ...

Chrome experiencing conflicts with backstretch when using multiple background images

In order to dynamically apply fullscreen background images in a WordPress site, I am utilizing Backstretch.js along with a custom field. Everything is functioning properly for the body's background image. However, there seems to be an issue with anot ...

The HTML modal window is experiencing loading issues

I am attempting to implement a modal box that appears on click in an HTML document. The HTML code looks like this: <a href="#openModal">Open Modal</a> <div id="openModal" class="modalDialog"> </div> <a href="#openModal">O ...

Ways to give a z-index to create distance between an image and a div's border

Fiddle: https://jsfiddle.net/0qqnvrdg/ HTML: <div class="loading"></div> CSS: body { background: #0d8aa5; } .loading { position: absolute; left: 50%; top: 25%; /*margin: -60px 0 0 -60px;*/ background: #fff; width: 200px; ...

What could be causing the lack of functionality in the responsive feature?

What could be the reason for the disappearing responsive effect of the navbar not working in this link? <nav> <li>Hello</li> </nav> <style>@media screen and (max-width:400px) { .nav { display: none; } </styl ...

I am encountering an issue where the characters "£" is displaying as "£" when my HTML is rendered. Can anyone explain why this is happening?

Here is the code I'm having trouble with: http://pastebin.com/QBLeLyNq. For some reason, the "code" part isn't working correctly. Any help would be appreciated. I used to run a small business and had a profit of £145 with an investment of only ...

Animation initiated when clicking the show/hide button to transition to the next page

Having recently delved into the realm of website programming, I was able to make some adjustments to the CSS code of my Wordpress theme called Expositio (wpshower / themes / expositio). One particular piece of code that caught my attention is what I belie ...

Clickable list element with a button on top

Within my web application, there is a list displaying options for the user. Each 'li' element within this list is clickable, allowing the user to navigate to their selected option. Additionally, every 'li' element contains two buttons - ...

Building a bespoke pagination feature with react-table

Looking to personalize the pagination with links for "Previous," page numbers, and "Next" like this example: https://i.sstatic.net/C4vsw.png I'm currently using react-table version 7 but have been unable to replicate the desired pagination style. I ...

Delete class at waypoints

I am currently using waypoints.js to manage a single-page website that includes a highlighted navigation feature. When the viewport reaches the element with the class "content", the corresponding navigation point is given the class "active". The script i ...

Is there a way to align an image alongside text in CSS with Bootstrap 4?

I am working on creating a box that displays the profile photo of a user along with their nickname on the right side. To achieve this, I have attempted various approaches while utilizing Bootstrap 4: My initial attempt involved using columns, but it did n ...

What is the best way to increase a numerical input?

While experimenting with HTML input elements, I decided to utilize the step attribute. This allowed me to increment the current value by 100 when clicking the up or down arrows in the input field. However, I discovered that the step attribute restricts th ...

Alternating CSS Designs for Displaying Multiple Mysql Query Results

I have a website where users can search for a specific product in their location, and the site will display a list of results. if(isset($_POST['zip'])){ $qry="SELECT business_id FROM ".TBL_BUSINESS." WHERE zip LIKE '%".$_POST['zip&apos ...

What is the procedure for retrieving values from a table?

<tbody> <tr> <td><span style="">Price</span></td> <td><span style="">:</span></td> <td><span style="">660</span></td> </tr> <tr> <td><s ...

Issues with displaying or hiding a DIV using javascript - popup box unresponsive

I am working with this ASPX code: <div id="IsAccountingOk" class="modalDialog"> <div> <a href="#close" title="Close" class="close">X</a><br /> <asp:Label ID="lblIsAccountingOkHeader" runat="server" Text ...

I'm baffled by this unsemantic grid - why is the final div getting pushed below the rest?

I am working with the unsemantic fluid grid system and aiming to create a row of divs that are all in line and together cover 100% of the page. <div class="grid-container"> <div class="grid-parent yy name-strip zz"> <div class="yello ...

How can I retrieve a PDF from a URL provided by the server using AngularJS?

Is it possible to automatically download a PDF file from a URL received through a $http GET() request from the server? The $http request is triggered by clicking a button on the front-end, and upon successful completion of the request, the URL where the PD ...

Align an Image Vertically Using Bootstrap's Grid System

Hey there! I've been trying to center an image within a "div" tag using Bootstrap, but despite my best efforts and reading through various resources, I haven't been able to crack it. * { margin: 0; padding: 0; } .people-one { w ...

Menu elements should display a responsive behavior where on mobile devices, only the icon is shown instead of the word "menu"

Due to the length of our company logo, we need a way to hide certain letters in the Menu and Basket sections, while still displaying the icons. Wrapping the names in span tags and using visibility:hidden; works but leaves empty space visible on the right s ...