Creating a visually appealing layout with rows of images of varying heights to ensure consistent spacing between text

As part of my Photo Library project, I am designing a display page that showcases four key attributes of each photo - File Name, Title, Date Taken, and Photographer Name. Additionally, there will be a preview thumbnail of the photo itself. While I aim for a consistent look, the challenge arises when dealing with both landscape and portrait images. The landscape images maintain consistency, but the portrait ones stretch out the spacing between attribute rows, disrupting the overall appearance.

If you'd like to view the sample code, it can be accessed on JSFiddle at the following link: https://jsfiddle.net/tsmolskow/37hkszbq/61/

Below is an excerpt of the HTML and CSS code:

<style>
.right-Padding{
   padding-right: 10px; 
}
img.resize {
   width: 50%;
   height: 50%;
   max-height: 125px;
}
</style>
<table style='font-size:15px'>

... (HTML Code continues)

CSS Code:

.right-Padding{
 padding-right: 10px; 
}
img.resize {
    width: 50%;
    height: 50%;
    max-height: 125px;
}

Answer №1

Initially, the first image you provided had a rowspan of 6 instead of 4. To rectify this, set a maximum height for your images, such as 90px. Additionally, remove the width and height declarations of 25% from the <td> cells containing the images. Lastly, consider whether tables are necessary for your layout – using CSS Grid may be a more suitable option.

table{
   width:100%;
}
td{
   border:solid 1px #000;
}
img{
   max-height:90px;
}
<table style='font-size:15px'>
  <tr>
    <td font-size='40px'>
      <a href='" + href + "'>Image Name</a>
    </td>
    <td rowspan='4'>
      <a href='" + href + "'>
        <img align='middle' src='https://p1.liveauctioneers.com/3283/129454/65998802_1_x.jpg?version=1540061833&format=pjpg&auto=webp&quality=50'>
      </a>
    </td>
  </tr>
  <tr>
    <td width='50%' style='padding-right: 10px;'>Image Tile</td>
  </tr>
  <tr>
    <td>Image Date Taken</td>
  </tr>
  <tr>
    <td style='padding-right: 10px;'>Image Taken By</td>
  </tr>
  <tr>
    <td font-size='40px'>
      <a href='" + href + "'>Image Name</a>
    </td>
<td rowspan='6'><a href='" + href + "'><img align='middle' src='https://i.pinimg.com/474x/09/f6/83/09f683f4fde5a1e70c785ad1dedca58b--silver-belt-buckles-silver-belts.jpg'></a></td></tr>
<tr><td width='50%' style='padding-right: 10px;'>Image Tile</td></tr>
<tr><td>Image Date Taken</td></tr>
<tr><td style='padding-right: 10px;'>Image Taken By</td></tr>

</table>

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

Is Material-ui's sx feature able to produce optimized utility classes like tailwindcss?

When utilizing Tailwind CSS, it is compiled in the following manner: <div class="font-bold"></div> <div class=".font-bold"></div> This compiles to: .font-bold{ font-weight: bold; } So... when using SX like thi ...

Clearing the content div and making it reappear using javascript

I am currently utilizing jQuery's CustomBox modal feature. While it is functioning properly, I am seeking a way to hide the div behind the modal (excluding the background image) when the modal is activated. I have successfully achieved this, but I am ...

Tips on saving Firebase Storage image url in Firebase database?

How do I store the URL of an image uploaded to Firebase Storage in Firebase Database? When executing the code below, I encounter the following error: Uncaught (in promise) FirebaseError: Function DocumentReference.set() called with invalid data. Unsuppor ...

Resetting the countdown timer is triggered when moving to a new page

In my current project, I am developing a basic battle game in which two players choose their characters and engage in combat. The battles are structured into turns, with each new turn initiating on a fresh page and featuring a timer that counts down from ...

Odd behavior from CSS

Running into a bit of a snag with my website lately, specifically with the CSS. As I'm relatively new to web design, these issues tend to crop up more frequently. Usually, I can solve them on my own, but this one has me completely puzzled. What' ...

Locating all elements on a webpage that are either above or below a specific element, capturing those that intersect visually

Is it possible to locate all the additional HTML elements that a particular element overlaps with, is positioned under, or intersects with? My goal is to ensure that this element is displayed above every other element. I am looking to identify all interse ...

The art of linking JavaScript events

I'm encountering some challenges with linking events together. I've set up an eventListener on a variety of links that, when hovered over, trigger a drop-down menu to appear. Everything is functioning properly, but I also want triangular shapes ...

Troubleshooting problem with printing iframes on Firefox

When attempting to print an iframe with a large amount of data using the code below, I'm encountering an issue in Firefox where only the first page is printed. The rest of the pages are not being included in the printout. window.frames[frameID]. ...

The CSS formatting is not being properly applied within the innerHTML

I have a scenario where I am trying to display a Bootstrap card using innerHTML in my TS file, but the styles are not being applied to this content. I suspect that the issue might be because the styles are loaded before the component displays the card, cau ...

Creating an editable list item with jQuery: A step-by-step guide

I am trying to create a user-friendly interface where users can view and edit their information in a listview. The data will be retrieved from a database and displayed in the listview. My goal is to make the listview editable, so when a user clicks on it ...

Alignment of horizontal divs

In the speakers section, I need to align the profiles of the speakers. All the images are usually the same size, but for some reason, every two lines an element appears on one line. Check out the page here for reference. ...

"Struggling to make the 'overflow: hidden' property work for an absolutely positioned

I'm struggling to conceal an absolutely positioned image within a CSS grid layout. Below is the code snippet: HTML: <div class="relative-parent"> <div v-for="item in 12" class="hiding-parent"> <div c ...

Items positioned to the left will not overlap

Having trouble with floating elements? Need to ensure that box 3 aligns under box 1 when resizing the browser window? Use this HTML template: <div class="box"> <p>box 1</p> <p>box 1</p> <p>box 1</p> & ...

Instructions on refreshing a webpage after choosing a sorting option using the onchange attribute

I'm encountering a small issue where the page won't refresh when I select a parameter from a dropdown list. Strangely, when I tested it on a separate document, there was no problem. I suspect Bootstrap may be causing a block somewhere. As someone ...

Ajaxed div disappears and reappears only after the div has finished loading

I ran into an issue with my jquery ajaxed site. The main content div is in the center with navigation on top. I needed to AJAX the content to prevent the flash video from restarting after each page load. My solution involved using the following code: $(do ...

The intl-tel-input dropdown feature is malfunctioning on mobile browsers

Currently, I have integrated the intl-tel-input library into my project for selecting international telephone numbers from a dropdown menu. https://i.sstatic.net/vPfpd.png While accessing the application on a web browser, the country flags display correc ...

Exploring Vue 3: Choosing between using import statements in main.js and configuring additionalData in vue.config.js to load a global scss file

I am attempting to load a global SCSS file using the "vue.config.js" file. vue.config.js module.exports = { css: { loaderOptions: { sass: { additionalData: `@import "@/assets/common.scss";` } } } } If I include the style tag in my App. ...

Is there a way to adjust the text color based on whether a value is negative?

I am currently developing a web application that performs addition operations on integers. Within this application, I have implemented two functions named num1() and num2() to retrieve the integers provided by the user for calculation. My objective is to m ...

What is the best way to adjust the position of the left-aligned button on an HTML table so that it

https://i.sstatic.net/DIIsv.png I'm working with HTML code that has tables wrapped around with Divs using Bootstrap. The issue I'm facing is that the "Sold By" Table is not aligned with the rest of the content and I want to move it more towards ...

Python web scraper unable to locate specified Xpath

My question was previously posted here: Xpath pulling number in table but nothing after next span In testing, I successfully located the desired number using an XPath checker plugin in Firefox. The extracted results are displayed below. Although the XPa ...