Arranging card images in a row using semantic cards for optimal alignment

Trying to create a row of semantic-ui cards with images at the top, I ran into an issue with varying image heights causing different card title positions. The goal is to have all images be the same height while still adapting to larger screens.

Although I came across a solution on Stack Overflow (see here), it didn't fully address my problem.

For reference, here is the semantic-ui documentation for a card (the foundation of my design):

Answer №1

Here are a couple of solutions to consider:

.card {
  position: relative;
  margin: auto;
  display: inline-block;
  background: purple;
  width:200px;
  height:300px;
  
}

.image {
  width:200px;
  height:200px;
  background-image: url('http://image2.redbull.com/rbcom/010/2013-07-25/1331603705670_2/0010/1/900/600/2/red-bull-illume.jpg');
  background-size: cover;
}



.image1 {
  width:200px;
  height:200px;
  background-image: url('http://image2.redbull.com/rbcom/010/2013-07-25/1331603705670_2/0010/1/900/600/2/red-bull-illume.jpg');
 -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
}
<div id=background> 
  <div class=card>
    <div class=image></div>
  </div>
   <div class=card>
     <div class=image></div>
  </div>
   <div class=card>
  <div class=image></div>
  </div>
  
</div>


<div id=background> 
  <div class=card>
    <div class=image1></div>
  </div>
   <div class=card>
     <div class=image1></div>
  </div>
   <div class=card>
  <div class=image1></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

The outcomes may vary even with identical fonts, character spacing, and line-height

When I first learned about @font-face in CSS3, I was excited about the prospect of using consistent fonts across all browsers. However, after experimenting with it using the code below on jsFiddle, my expectations were challenged: HTML: <div> T ...

What is the best way to align text and an arrow on the same line, with the text centered and the arrow positioned on the

.down { transform: rotate(45deg); -webkit-transform: rotate(45deg); } .arrow { border: solid black; border-width: 0 3px 3px 0; display: inline-block; padding: 30px; } <p>Down arrow: <i class="arrow down"></i></p> Looking to ...

Positioning a footer at the absolute bottom of a webpage

I am currently working with 2 divs that are absolutely positioned within a relative container. I intend to utilize JavaScript for toggling visibility. .container { position:relative; } .section1 { position:absolute; top:0; left:0; right:0; ...

Although Angular allows for CSS to be added in DevTools, it seems to be ineffective when included directly in

Looking to set a maximum length for ellipsis on multiline text using CSS, I tried the following: .body { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; } However, this approach did not work. Interesti ...

Having trouble with setting the margin-top of a div?

When I attempted to apply the margin-top property to a div's style, it didn't have any effect. https://i.stack.imgur.com/jyY2G.png Below is the code snippet: .side { margin-left: 65%; margin-top: 3%; margin-right: 3%; border: 1px sol ...

The table is overflowing its parent element by exceeding 100% width. How can this issue be resolved using only CSS?

My root div has a width of 100% and I need to ensure that all children do not overlap (overflow:hidden) or exceed the 100% width. While this works well with inner <div>s, using <table>s often causes the table to extend beyond the parent 100% d ...

Duplicate user scrolling input within a specified div container

I am attempting to recreate a horizontal scrolling effect on a div element that mirrors the input scroll. When the user scrolls along the input, I want the div element to scroll in sync. The issue I am encountering is specific to Chrome, where the input b ...

Can JavaScript impact the appearance of the printed version of a website?

Just a quick question - I currently don't have access to a printer. My client is wondering if the hidden elements of the webpage (items that are only visible when clicked on) will be included when printing or if they will remain hidden? ...

Ways to position an element at the edge of the browser either on the left or right side when the image is not in a centered container

Looking to create a unique layout that involves: Utilizing a three-column structure Incorporating a div element that spans two columns Positioning an image within the two-column div so that it extends to the left edge of the browser window while staying ...

`Can you guide me on the proper path for designing this website layout?`

As I embark on creating my first website, I have a specific vision in mind. I want the full display on a computer screen to show all the information and links without any need for scrolling. However, when the window is resized to smaller screens, I would l ...

Restrictions on the number of characters based on the size of fonts in an html list sc

Recently, I attempted to implement a ticker message on my website using li scroller. However, it appears that there is a limitation on the number of characters that can be displayed in the ticker message when different font sizes are used. With a smaller ...

Introducing Bootstrap 5 with a sleek two-column layout that effortlessly allows text to wrap around captivating images

Struggling to find a solution for implementing two columns in a row? Look no further! In the left column, insert an image with classes md-3 or lg-4. In the right column, place a lengthy text using classes md-9 or lg-8. If you want the text to wrap around ...

Boxes that expand to full width and appear to float on

I am dealing with a situation where I have a container that holds multiple child elements such as boxes or sections. <section> <div>Box 1</div> <div>Box 2</div> <div>Box 3</div> <div>Box 4< ...

Ways to display an image within a div when hovering over a specific element?

I am working on recreating a specific effect found at in the section titled 'Capture and share anything quickly'. The effect involves displaying an image in the right block when hovering over the left text. I have successfully implemented this e ...

Maintain the background color of the form select drop down even after clicking away from the form

I have customized a dropdown menu. <select name="country"> <option value="Andorra">Andorra</option> <option value="Albania">Albania</option> <option value="Armenia">Armenia</option> <opt ...

Modify font color in collapsed state of bootstrap navbar dropdown

I've been attempting to modify the font color displayed in the image to ensure it stands out clearly. https://i.sstatic.net/e6VdG.png This is a simple bootstrap 3 navbar. Here's the HTML code: <nav class="navbar navbar-custom"> ...

Creating a customized icon scheduling feature with CSS

Creating an icon using CSS that looks like the one below seems to be quite challenging. I attempted to achieve it with this approach, but the result was not satisfactory. https://i.stack.imgur.com/5W7Hj.png .schedule { height: 10px; width ...

What might be causing Flex not to function properly on my personalized landing page?

I attempted to create a basic landing page featuring an image background with a logo, button, and a row of 4 images displayed side by side using Flex. However, for some reason, the Flex is not functioning properly for the row of images. Here is the code s ...

Alter the typography of the text that has been enhanced by Google

I am attempting to modify the default font of certain text that is processed through google-code-prettify within an angular directive. The structure of the template served by my directive appears as follows: <pre class= "prettyprint" style= "border:1p ...

Comparing the Calculation of CSS Selector Specificity: Class versus Elements [archived]

Closed. This question requires additional information for debugging purposes. It is not currently accepting answers. ...