arranging three divs in a row, with one div expanding to fill the entire height while the other two divs evenly split the remaining

I am attempting to create a content row consisting of 4 divs:

1 container div 3 divs within the container: 1 image - taking up the full height 2 text - sharing the height, but each on a separate line.

It should resemble the following: https://i.sstatic.net/ErhBp.png

I am unsure which CSS position/display properties to use. The possibilities seem endless and I have not been able to find a working combination. In addition to the code in the example, I have experimented with different combinations of CSS display properties like block, inline-block, and more.

This is the code I have tested:

div.contentItemDiv {
display:inline-flex;
height:80px;
width:100%;
margin-bottom:10px;
}

div.picItemDiv {
display:flex;
height:100%;
width:20%;
border:1px dashed;
}

div.itemTitleDiv {
display:flex;
height:30px;
flex-wrap: nowrap;
width:40%;
}

div.itemInfoDiv {
display:flex;
height:50px;
width:40%;
overflow:hidden;
}
<div class="contentItemDiv">
<div class="picItemDiv"><img src="pic.jpg" ></div>
<div class="itemTitleDiv">a title</div>
<div class="itemInfoDiv">some content</div>
</div>

Thank you!

Answer №1

I put together a code snippet that mimics the layout in your provided image:

<div class="product">
  <div class="image-wrapper">
    <img src="https://picsum.photos/60" />
  </div>
  <div class="text-content">
    <p>
      Here goes the product name
    </p>
    <span>
      Some additional information here.
    </span>
  </div>
</div>

And below is the corresponding CSS styling:

.product {
  display: flex;
  align-items: center;
}

.image-wrapper {
  flex-shrink: 0;
}

.image-wrapper img {
  border-radius: 50%;
}

.text-content {
  padding: 0 0 0 10px;
}

.text-content p {
  margin: 0;
  font-weight: bold;
}

You can view the final result in this JSFiddle link.

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

Tips for managing table scroll in a flexbox design

Check out the demo here I am working with a table that has an indefinite number of rows and columns. When the table has a small number of rows and columns, it adjusts its width according to the available page space minus the width of the sidebar. Everythi ...

Is there a way for me to view the output of my TypeScript code in an HTML document?

This is my HTML *all the code has been modified <div class="testCenter"> <h1>{{changed()}}</h1> </div> This is my .ts code I am unsure about the functionality of the changed() function import { Component, OnInit } f ...

A structured HTML table featuring a secure header and stable left-hand columns, complete with knockout controls embedded in both the header and first

I'm facing a challenge with a customizable HTML table: Each row has a checkbox (knockout bound) to allow the user to determine if it should be included or not. The header columns also have checkboxes (knockout bound) to indicate if a particular ...

What is the best way to extract the numerical value from a JavaScript object?

I'm currently working on a web form for a currency exchange demonstration. I have included a snippet of HTML and Javascript code that I have initially implemented. <!DOCTYPE html> <html lang="en"> <head> <meta charset="ut ...

What methods can be used to defer the visibility of a block in HTML?

Is there a way to reveal a block of text (h4) after a delay once the page has finished loading? Would it be necessary to utilize setTimeout for this purpose? ...

Guide on obtaining the file path of an uploaded file through the use of HTML, JavaScript, and PHP

After successfully uploading an image from my drive, I am encountering an issue where I am unable to locate the folder path of that image For example: C:\Images\Logo\Image.png $('#pngfile').change(function (e) { var tmppath = URL ...

Pass the input array using a jQuery Post request without the need to submit the form

I am looking to send data to a URL without the need to submit a form and reload the page, but my JQuery skills are not very strong. Can someone show me how to achieve something like this in HTML? <input type="text" name="name"> <input type="text" ...

How to customize the hover and active properties of a checked checkbox in Vue 3 using Tailwind CSS and PUG?

It seems that checkboxes have a level of sophistication that I never anticipated, or perhaps my brain just can't quite grasp the nuances of checkboxes. After spending a significant amount of time researching and experimenting with checkboxes in a Vue ...

Resetting several sticky titles after displaying and hiding elements

Inspired by a popular codepen example, I have successfully implemented sticky titles in my sidebar. However, when integrating these sticky titles with the functionality to show/hide related items on click, I encountered some unexpected issues. The code sni ...

The integration of a Bootstrap modal within the side bar's rendering

Struggling with a modal appearing inside my side div and can't find any solutions in the bootstrap5 documentation or online forums. https://i.stack.imgur.com/gHsBi.png I just want the modal to display centered on the page with the background fade ef ...

How to Correctly Align Links in Bootstrap Navbar

I am currently utilizing Bootstrap 5 and I am looking to perfectly center some links within the navigation bar. <header> <nav class="navbar navbar-expand-lg py-5"> <div class="container"> ...

How can I trim a value using one-way data binding in Angular?

Is there a way to trim values in Angular using one-way data binding? Can this be done directly in the component.html file rather than in typescript? I tried the following but it didn't work: <P>{{country.trim()}}</P> Thanks ...

Creating a tooltip for new list items: A step-by-step guide

I'm currently working on creating a tooltip using JQuery for incoming list items. Users will input text in a textfield, press enter, and those values will be displayed in a visible list on the website. I intend to have a tooltip associated with each i ...

What is the best way to ensure a jQuery function runs on duplicated elements?

I have been attempting to construct a webpage featuring cascading dropdowns using jQuery. The goal is to generate a duplicate set of dropdowns when the last dropdown in the current set is altered. I aim for this process to repeat up to 10 times, but I cons ...

The process of converting a data:image base64 to a blob is demonstrated in this code snippet

Seeking a way to convert data:image base64 URLs to blob URLs. Below is the original code that generates the base64 URLs: <script> $(window).load(function(){ function readURL() { var $input = $(this); var $newinput = $(this ...

Ways to access the innerHTML of a specific HTML element by targeting its class using jQuery

I'm working with HTML code that looks like this: <div class="a">html value 1</div> <div class="a">html value 2</div> Is there a way to retrieve html value 1 and html value 2 using jQuery? ...

What is the best way to position a Button on the far right of an MUI AppBar?

I'm struggling to grasp the concept of aligning items in MUI. Here is my code snippet: class SignUpForm extends React.Component { render() { return ( <Button sx={{ justifyContent: "flex-end" }} colo ...

Enhance your website with Jquery-powered page transitions that can easily be linked for a

I have a client who has a specific vision for their website. To demonstrate the concept, I've created a demo which can be viewed here: She requested page transitions similar to those in the demo for the main content. I used jQuery to implement this ...

Tips for managing the transparency level of a container's backdrop using CSS?

Is there a way to adjust the transparency of an image, change the background color of a container, button, or form using CSS? Which specific property would be appropriate for this task? ...

Integrating HTTP JSON responses into HTML using Ionic 2, Angular 2, TypeScript, and PHP: A comprehensive guide

Currently in the midst of developing my first Ionic 2 app, however, my understanding of typescript is still limited.. I aim to execute the authenticate() method within my constructor and then to: Retrieve the entire JSON response into the textarea and/o ...