Flexible height horizontal list

Looking to create a horizontal list with image contents that adjust their size based on the height of the ul, which in turn is responsive to the container's height.

Take a look at this fiddle: http://jsfiddle.net/nLcrW/

#container{
    display: block;
    position: absolute;
    top: 15%;
    height: 70%;    
    background: cyan;
}

.HList{
    list-style: none;
    padding: 0;
    margin: 0;
    white-space: nowrap;
}
.HList-Item{
    display: inline-block;   
    height: 100%;
}
.HList img{
     height: 100%;
}

When you try scaling the container window in the fiddle, you'll notice that the images overlap when scaled up and stretch when scaled down in Chrome and Firefox. Safari seems to handle it fine though.

Is there another way to address this issue or a workaround for these browsers?

Answer №1

Check out the latest version of your JSFIDDLE.

Simply adjust the size of the HList-Item to ensure the image is 100% of that.

Feel free to experiment with the styling, add or remove whitespace, embed images in an anchor tag, and more.

CSS


#container{
    top: 15%;
    height: 70%;    
    background: cyan;
}
.HList{
    list-style: none;
}
.HList-Item{
    display: inline-block;
    height: 5%;
    width: 18%;
}
.HList img{
    height: 100%;
    width: 100%;
}

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

Implementing full-height list elements using CSS

I'm still facing challenges with my lists... After receiving some assistance, I was able to create a horizontal list with perfect dimensions for my needs: each element taking up 33.33% width and adjusting its height based on the tallest element. I ac ...

Exploring the functionalities of scss and minified files within Visual Studio 2017

I have very little knowledge of scss. In our Visual Studio 2017 solution explorer, there is a .scss file called Theme6.scss. When I expand it, I see a file named Theme6.css. Upon expanding that file, two more files are revealed: Theme6.css.map and Theme6. ...

What is the process for inserting fa fa icons within a text input field?

Struggling to place a fa fa icon inside an input text box for my Angular 4 project. Despite trying various solutions from Stack Overflow, none have proven successful. Here is the code I have attempted: <div class="form-group has-feedback"> <input ...

Jquery Parallax Scrolling - Dynamic Multi-Directional Effect

My client is looking for a multi-directional JQuery parallax page, similar to this example - I have the necessary artwork and discovered various jQuery libraries that support horizontal and vertical scrolling separately. However, I am struggling with comb ...

What is the best way to separate a string using JQuery?

My menu contains PNG icons. I am looking to achieve a hover effect where the PNG icon changes to a GIF icon when the user hovers over a menu item. I've attempted the following: jsFiddle $("#image").mouseenter(function(){ // I can set GIF url her ...

Opacity problem when hovering on Chrome

Work in progress: Hello everyone, I'm facing an issue with a hover effect that only seems to be occurring in Chrome. When hovering over a tile, the background color changes, the image opacity decreases, and an icon appears over the image. In Chro ...

Combining a left vertical navigation bar with a top navigation bar in Bootstrap 4

I am currently working on creating an admin UI using bootstrap 4 that includes two menus, one vertical and the other at the top bar. My goal is to have a navigation layout similar to this: https://i.sstatic.net/q2NbY.png Here is the snippet of my HTML co ...

What is the best way to apply styling to an image that is contained within the document.write function?

I'm looking to customize the design of this cat image, but I'm struggling to locate where to incorporate the div class. It's likely a basic step, but as a beginner in JavaScript, I'm hoping that someone can assist me. document.write(&ap ...

Simple Design Techniques for HTML Tables

I seem to be having trouble with the table styles when I include text in the <td> section: <td rowspan="3"> 30th May 2014 17:35... What could be the issue? <style type="text/css"> .tftable {font-size:12px;color:#333333;width:100%;borde ...

Guidance on displaying values from one PHP file in another PHP file

Is it possible to achieve this scenario? I have two files, named main.php and submenu.php. In main.php, I have the main menu defined as follows: In another file called submenu.php, I have a list structured like this: <ul> <li>1</li> &l ...

The flex box container has an overflowing issue despite the implementation of overflow:hidden and setting a min-width of

Struggling to make my flex box container fit in the div Despite setting min-width: 0 and overflow: hidden as a last resort the flex box simply won't shrink when the width changes Check out what happens when the width is adjusted: https://js ...

Using requestAnimationFrame to animate several independent objects

I'm currently working on animating two different objects: a square and a circle. Each object has its own button to initiate the animation, which involves moving the object from left to right. However, I've run into an issue where clicking on one ...

Regular expression for finding CSS key-value pairs

Currently, I am utilizing regular expressions to identify CSS values. The input string that needs to be matched is: font-size:25px;font-family:georgian;content:"' unicode given in pseudo &#169; '"; The specific regex pattern I am using fo ...

CSS: incorrect text alignment

I'm encountering an error with text-align. I want my text aligned to the left, but it's starting from the center. I've tried to fix it without success. Can someone please review and correct my code? CSS .text { width: 100%; height: ...

Developing an editor

Currently, I am delving into the concept of object inheritance in JavaScript through a practical exercise where I am creating an online editor similar to the one I am currently using. However, I find myself slightly confused as I aim to utilize data-* att ...

Unusual happenings detected in Magellan Fixed with Foundation 5

I need help creating a product summary sidebar similar to Apple's. I'm using Magellan but it seems to break the page when the width is below 960 pixels. It might be related to the table, but I'm not sure. Any suggestions or assistance would ...

Utilizing two distinct CSS frameworks within a single Rails application

At the moment, I have an application with its frontend built using Bootstrap 3 (leveraging the bootstrap-rails gem). Now, I am looking to incorporate the Materialize.css framework into the same app. After downloading the Materialize.css stylesheet, my conc ...

How can I center an image next to text on two lines, that is compatible with IE7?

I am trying to align an image (logo) with text in two lines - the website title and a brief description. Here is my attempt using HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional ...

What could be causing my custom Google font in CSS to not function properly?

I've been trying to change the font-family from Google Fonts in my Bootstrap 5 project, but it's not working as expected. Here's a snippet of my code: HTML <div class="row"> <div class="col-lg-6 col-md-12" ...

The tab content in VerticalTab Material React UI is spilling out and overflowing

Having some trouble with this particular component. Whenever I input content larger than my Grid size, it overflows the VerticalTab section. You can see an example of this in this codesandbox. Here's what I've attempted: return ( <div cla ...