Tips for incorporating image and text sections into a responsive layout

I have implemented the following CSS to organize 8 sections of text and images. The issue is with fixing the size of the boxes, as they currently adjust based on their content length. This means that a box with shorter content will appear smaller than a box with longer content.

CSS

.test{
  min-width:80%;
  max-width:80%;
  margin: 0 auto;
}


.test ul {
  text-align:center;
}

.test ul li{
  box-sizing: border-box;
  text-align:left;
  list-style:none;
  display:inline-block;
  vertical-align:top;
  width: 23%;
  min-height: 240px;
  border: 1px solid orange ;
  border-radius: 5px;
  padding:1%;
  margin: 0.5%;
}

.test li p{overflow: hidden; margin: 10px;}
.test p + p{clear: both;}
.test li p img{float: right; margin-right:10px;}
.test h2{margin-left: 2.2%;}

HTML

<div class="test">
<h2>This is the test of 8 sections</h2>
    <ul>
  <li><p>
    <img src="../img/d.jpg" width="50" height="50"/>
    test tfdfdf dfdf<br/>
    454 4545 45<br/>
    32434 34234
</p>
<p>
  blah blah blah Text Here <br/> See more …
</br>

</p></li>
<li><p>
    <img src="../img/d.jpg" width="50" height="50"/>
    test tfdfdf dfdf<br/>
    454 4545 45<br/>
    32434 34234
</p>
<p>
   blah blah blah Text Here <br/> See more …
</br>

</p></li>
<li><p>
    <img src="../img/d.jpg" width="50" height="50"/>
    test tfdfdf dfdf<br/>
    454 454545 215<br/>
    32434 34234
</p>
<p>blah blah blah Text Here <br/> See more …
</br>
</p></li>
<li><p>
    <img src="../img/d.jpg" width="50" height="50"/>
    test tfdfdf dfdf<br/>
    45456 5565<br/>
    32434 34234
</p>
<p>blah blah blah Text Here <br/> See more …
</br>

</p></li>
 <li><p>
    <img src="../img/d.jpg" width="50" height="50"/>
    test tfdfdf dfdf<br/>
    454 4545 45<br/>
    32434 34234
</p>
<p>
   blah blah blah Text Here <br/> See more …
</br>

</p></li>
 <li><p>
    <img src="../img/e.jpg" width="50" height="50"/>
    Test test<br/>
    3434 343434 34343<br/>
    Test new Test
</p>
<p>blah blah blah Text Here <br/> See more …
</br>
</p></li>
<li><p>
    <img src="../img/f.jpg" width="50" height="50"/>
   <b>fdgfg dfgg fdg</b><br/>
     435345 435345<br/>
    Gladstone Qld
</p>
<p> blah blah blah Text Here <br/>See more …
</p>
  </li>
  <li><p>
    <img src="../img/g.jpg" width="50" height="50"/>
    Test Test is test<br/>
   444 5444 4444<br/>
   Test test
</p>
<p>
   blah blah blah Text Here <br/> See more …
</p>
</li>
</ul>
</div> <!-- test --> 

JsFiddle Click Here

Answer №1

To ensure that Boxes maintain a fixed height, you can implement a vertical scroll feature to prevent content from being hidden. Give this solution a try:

.test ul li{
max-height: 250px;
overflow-y: scroll;
}

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

Incorporate CSS Style Sheet into UI Router State without using Bower

It can be overwhelming to try to keep up with all the latest technologies, especially when you're in the middle of a project. Lately, I've been wanting to add a CSS stylesheet to a UI Router state. I came across this helpful post that addresses ...

Enhancing the menu/navigation bar with individual AJAX loaders

I have chosen the Vivant Designs theme for our website, which can be found at What I am looking to achieve is an ajax loader that will appear next to the link or tab when a user clicks on a link within the drilldown menu located on the left side. The cont ...

Unable to set focus on a disabled button programmatically, issue persists

$(function () { $('#save').click(function() { $('#save').attr('disabled', 'disabled'); console.log($(document.activeElement).attr('id')); }); $('#test').focus(); co ...

I am attempting to format an HTML form with proper indentation, but it seems to be eluding me

Struggling to design a custom registration form template, I'm facing an issue where paragraph spaces or indents are not being recognized by the program, even in the preview pane. Seeking assistance with this problem. I am attempting to position this ...

How to dynamically change the class of an element that contains other elements using JavaScript and JQuery

I have created a blog archive with the following format: +Year +Month Title Here is a snippet of the code: <ul> <span class="toggle">+</span> <li class="year">$year <ul> <span ...

Can one look through a div to the one beneath it by moving the cursor?

Hey there! I have a unique question for you. I've been trying to achieve a specific effect where two divs are stacked on top of each other, and the content of the lower div is only revealed in a certain area around the cursor. Is it possible to make o ...

ASP.NET Core 2.1 struggling to implement Shared Layout view across all views

I am facing an issue where the layout view is not consistent across all pages on my website. While the home page and main pages share the same layout, other pages like the login page lack styling and images. Additionally, features like CRUD operations also ...

Upon loading, the Carousel is visible instead of being hidden, which is contrary to its intended behavior

Any help would be greatly appreciated as I am struggling with creating a web page featuring tabs for "London, New York, Shanghai". The initial page displayed is the "welcome" page with the other tabs hidden on load. I successfully implemented a carousel f ...

I am struggling to create a responsive form using Bootstrap

I am facing an issue with my two forms that I want to have a fixed full-screen size. Despite trying different bootstrap options, they are not responsive at lower resolutions. What should I do to make them responsive? Here is the code: <form action=&a ...

Carousel position images off-center to the right on smaller screens

I created a fullscreen slider using the carousel bootstrap feature. However, when the screen size shrinks, the background image resizes and centers itself. Instead of centering the image on smaller screens, I want it to focus on the right side. Here is ho ...

jQuery - draggable and resizable functionality

On my website, I offer a unique feature where users can create their customized web pages based on pre-built templates. Initially, users start with a predefined page that they can then personalize by editing text areas, adding images, videos, and more. T ...

How can you add a new div directly after the parent div's content and display it in-line?

I have a banner that stretches to fill the width completely. Inside this main div, there is another smaller div measuring 30px in size positioned at the end. The nested div contains a close icon background image, and upon clicking it, the entire banner get ...

Adjustable diagonal line within a container using CSS styling

Seeking assistance with a rectangular div that can have its diagonal length adjusted using JavaScript. I am looking to add a diagonal line to label the diagonal length when it is increased or decreased using the +/- buttons. I require the line to resize a ...

Use JavaScript to submit a form in Django containing the <a></a> tag

I am having an issue with my form submission using JavaScript. When I try to submit the form, it is sending a GET request to the backend, but I am expecting it to send a POST request instead. Here is the HTML file code snippet: <form id="my_form&qu ...

color-transition effect (CSS-only)

I'm attempting to replicate the fading effect shown here in the lower right corner where the artist name and track title gradually fade out towards the right. Initially, I tried creating an overlay image, but it resulted in a jagged edge on the right ...

Has any of my predecessors been hidden from view?

How can we detect if one of an element's ancestors has the display:none property set without having to traverse up the DOM Tree? ...

What steps should I take to repair my jQuery button slider?

I am facing a challenge with creating a carousel of three images in HTML using jQuery. When the user clicks on the "Next" or "Previous" buttons, I want to scroll through the images one by one. However, I am struggling to hide the other images when one is d ...

image background not appearing in HTML, CSS, and JavaScript game

When working on a simple HTML, CSS, and JavaScript game, I decided to make a change in the CSS code. Instead of setting the background color to green as before, I opted to use an image with the following line: background-image: url(flappybird.png); I also ...

What is the best way to determine if a character is valid for use in HTML rendering?

There are certain characters, like ordinal 22 or 8, that do not appear correctly in HTML (when using Chrome for example when copying and pasting them into this 'Ask question' editor; assuming utf-8 encoding). How can I identify which characters a ...

Is it possible to record a video and save it directly to the server?

When using the Apache Cordova Plugin cordova-plugin-media-capture to capture a video, you may wonder how to send this video to your server and store it. An official example is provided on how to start capturing a video: // capture callback var captureSuc ...