Column flex, container width exceeded by column

Struggling to make the flex: column work properly so child elements do not exceed the parent container. The image on the left needs to take up 100% of the container's height:

.container {
  width: 500px;
  height: 300px;
  border: solid blue 1px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
}

.tall {
  height: 100%;
  width: 300px;
  background: yellow;
}

.row {
  margin: 10px 0;
  background: red;
  min-height: 10px;
}
<div class="container">
  <div class="tall"></div>
  <div class="row">This is text that should flow to multiple lines, adjusting its width based on the left block.</div>
  <div class="row"></div>
  <div class="row"></div>
</div>

No matter what I attempt, the rows on the right keep extending beyond the container, always matching the container's width instead of adjusting to the available space. Any suggestions on how to resolve this issue?

Answer №1

To enhance the layout, I suggest changing the flex direction to row and eliminating flex wrap. Additionally, you can enclose your rows in a div with flex-grow:1 and eliminate the height from the tall element:

.container {
  width: 500px;
  height: 300px;
  border: solid blue 1px;
  display: flex;
  flex-direction: row;
}

.tall {
  width: 300px;
  background: yellow;
}

.row-holder {
  flex-grow:1;
}
.row {
  margin: 10px 0;
  background: red;
  min-height: 10px;
}
<div class="container">
  <div class="tall"></div>
  <div class="row-holder">
    <div class="row">This is a text that should be multiline, with automatic width depending on the left block width.</div>
    <div class="row"></div>
    <div class="row"></div>
  </div>
</div>

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

Displaying static files in a base template using Django is a breeze

Is there a way to link base template with static files from outside the app in Django? I have been trying to figure out how to make static files used by the base template accessible to other templates that inherit from it. I have checked the Django docume ...

Attaching a click event to an input field

Seeking to serve html files from the server without relying on template engines. Below is the script used to start the server. // script.js const express = require("express"); const bodyParser = require("body-parser"); const app = express(); app.use(expr ...

Inserting data into a Textbox by clicking on a Div

I'm currently working on creating a wallpaper changer for my website. Right now, I'm looking to input the URL of a wallpaper into a text box when the corresponding DIV option in a CSS menu is clicked. Below is the JQuery I am using: $("div.bg8 ...

Is there a way to stylize the initial words of a brief text block by blending small caps with italics, all while avoiding the use of a span tag?

I have a series of images with numbered captions like "Fig. 1", "Fig. 2", "Fig. 3", followed by a brief description on the same line. Is there a way to programmatically style these strings (the “Fig. #” only) using CSS or Javascript to make them italic ...

What is the process for identifying the ActiveX control being referenced on a webpage?

After developing a web application using ASP.NET Web Forms, I encountered a challenge with a client who has strict security policies. Whenever they try to access the web page, Internet Explorer displays a message stating: Your security settings do not all ...

Ways to include a link/href in HTML using a global constants file

I have a constants file with a links node that I need to integrate into my HTML or TypeScript file. Constants File export const GlobalConstants = { links: { classicAO: '../MicroUIs/' } } I created a public method called backToClassicAO ...

Including React components in my HTML documents

I have developed a node.js server using express and am rendering an html page with jsx code embedded. The server is running smoothly, but I am encountering difficulties when trying to import other jsx components into my html file to utilize them in my main ...

How can I import the raw JSON data from a table into a pandas DataFrame?

I am attempting to extract the JSON data and convert it into a dataframe from: "" , which is the original data displayed in a table at the bottom of this page "" The content on the JSON page seems to be basic JSON data like"[{\"SECURITYCODE\":& ...

Transforming code into syntax-highlighted HTML

Seeking a Python module that can convert code written in various coding languages into syntax-highlighted HTML code. Want something akin to the code tag functionality used on StackOverflow. ...

Header Customization and Post Layout on Tumblr

In my recent purchase, I acquired the Margaret Studio theme from themecloset on Tumblr. Upon adding my own logo, it unexpectedly resulted in the first image on my blog being cut off with a white strip that seems to be the 'background' of my logo ...

I am interested in implementing a CSS overlay on an image

Is it possible to add an unclickable overlay on top of an image? I have provided a CodePen link in the comments section. Here is the HTML for the image: <img src="https://www.codeproject.com/KB/GDI-plus/ImageProcessing2/img.jpg" /> And ...

JavaScript Sort function malfunctioning and not correctly sorting

I am having trouble sorting div elements by price values. The code seems to be working fine, but the sorting of numbers doesn't appear to be completely accurate. For example, in my jsfiddle, when the button is clicked, the number 21.35 is displayed a ...

There is an unnecessary gap between the parent div and the image contained within it

Snippet of HTML code showcased below: <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="css/style.css" rel="style ...

How can I make the row color of a jQuery datatable change when the row is selected?

One of my challenges involves implementing a jquery dataTable (view here) where each row contains a checkbox. I want the row's color to change when the checkbox is checked. This is the approach I attempted: <table id="tabellaOrdinaFarmaci" class=" ...

Firefox seems to be the only browser where window.parent.document is functioning properly, as it is not working

Is there a way to update the value of a text box on the main page from an iframe? Currently, I have code that works in Firefox but not in Internet Explorer or Chrome. The "main.html" and "frame.html" files are located in the same directory. Any suggestions ...

Issue with F12 Functionality: Unable to Navigate to CSS Definitions within CSHTML Files in Visual Studio 2017

Currently, I am in the process of developing my very first Asp.net Core 2.0 Mvc website. While I typically rely on web forms, I decided to venture into something new. In my .cshtml files, I have encountered a limitation where I am unable to F12 or right-c ...

The code that functions properly in Internet Explorer and Chrome is not functioning as expected in Firefox

I created a jQuery function that is designed to allow only numbers and one decimal point in an input field of type text. While it works perfectly fine in Internet Explorer and Chrome, I've encountered an issue with Firefox where it doesn't seem ...

Activating/Deactivating a button with just a press

In my SQL data display, each row has an "Add To Zip" button that is initially enabled. I want to disable the button in the current row when it's clicked and later re-enable them using a different PHP file. What's the best way to achieve this with ...

When the page first loads, the slider is responsive, but it does not adjust

I installed the Moving Boxes plugin and customized it to create a full-width image slider. While it works well when the page loads, I'm facing challenges with making it responsive on resize. It appears that the JS script sets fixed widths upon load, w ...

Adjust the size of CSS elements on hover while removing any margin

I am currently working on making my navigation bar elements larger when hovered over. However, I'm facing an issue where the rest of the website shifts downward slightly when I mouseover them, and it doesn't look good. Is there a way to increase ...