• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: CSS vertical align with different image heights

Resolved: CSS vertical align with different image heights

0
By Isaac Tonny on 18/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I’m trying to vertically align the items in the first row for all possible image heights:
enter image description here
See here: https://lawncarepro.co.uk/code-test/
I have tried the solutions listed here How to vertically align an image inside a div including:
  • Setting .p-c to inline-block with height: 100%; and using vertical align middle on all three columns in the first row
  • Doing the above but with a new div for the first row
  • Using position: relative; and position: absolute; (this generally pushes things out of the box or changes the column order)
  • Using position: relative; top: 50%; transform: translateY(-50%); on the columns in the first row

Answer:

I would suggest going with CSS-Grid (and make changes as required):
I quickly played around the code and came up with this.
Please Note: One of the div’s is empty. So, you can manually set the display:none; if required. And align items are required. With Grids there are too many ways to layout our HTML. Just do some R&D ๐Ÿ™‚
enter image description here

If you have better answer, please add a comment about this, thank you!

css html vertical-alignment
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Java Virtual Machines deleted

27/03/2023

Resolved: PyCharm cannot see my newly compiled .pyc see on import

27/03/2023

Resolved: I am facing ERR_HTTP2_PROTOCOL_ERROR on my website

27/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.