I have to make that each part of the container is same height in all containers and since content can vary a lot for each container I just can't set hardcoded height because some of these inner containers exist for one but doesn't get added for other. Interested if this can be achieved by only using CSS, without javascript
So far I have tried with flexbox but not sure what I was doing wrong because it didn't work for me really and each container didn't take equal height based on the longest container.
Basically, what I have to do - match each container to be in equal height. If some text doesn't exist in one but exists in other needs to add empty space In pictures, it is something like this -
Expected (notice empty spaces also) -
My fiddle code with HTML structure I have - Fiddle code
Maybe needs to change some HTML structure also to get this to work? (i.e. moving container with a yellow border inside details container with purple border?). The most important part is to not use javascript but only CSS!
Thank you all!
My current HTML structure is something like this (also visible in fiddle) -
<ul>
<li class="li-item">
<div class="li-item-inner">
<div class="heading">
<div class="title">Some title text</div>
<div class="subtitle">Title subtitle goes here</div>
</div>
<a href="#" class="photo"><div class="img">Picture here...</div></a>
<div class="some-extra-block">
Some extra info for some li-item
</div>
<div class="details">
<div class="price">
<div class="item-price">15$</div>
</div>
<div class="small-images">
<div class="small-image">Some image here</div>
<div class="small-image">Some image here</div>
</div>
<div class="see-item">
<a href="#">click here to see item</a>
</div>
</div>
</div>
</li>
<li class="li-item">
<div class="li-item-inner">
<div class="heading">
<div class="title">Some title text goes here</div>
<div class="subtitle">Title subtitle goes here in 2 rows</div>
</div>
<a href="#" class="photo"><div class="img">Picture here...</div></a>
<div class="details">
<div class="price">
<div class="item-price">15$</div>
</div>
<div class="small-images">
<div class="small-image">Some image here</div>
<div class="small-image">Some image here</div>
</div>
<div class="see-item">
<a href="#">click here to see item</a>
</div>
</div>
</div>
</li>
<li class="li-item">
<div class="li-item-inner">
<div class="heading">
<div class="title">Some title text goes here</div>
<div class="subtitle">if subtitle more than 2 rows then gets cut off all the rest and doesn't show it like this </div>
</div>
<a href="#" class="photo"><div class="img">Picture here...</div></a>
<div class="details">
<div class="price">
<div class="item-price">15$</div>
</div>
<div class="small-images">
<div class="small-image">Some image here</div>
<div class="small-image">Some image here</div>
</div>
<div class="see-item">
<a href="#">click here to see item</a>
</div>
</div>
</div>
</li>
<li class="li-item">
<div class="li-item-inner">
<div class="heading">
<div class="title">Some title text goes here which will be atleast 3 lines long</div>
<div class="subtitle">Title subtitle goes here</div>
</div>
<a href="#" class="photo"><div class="img">Picture here...</div></a>
<div class="details">
<div class="price">
<div class="before-price">Some text</div>
<div class="item-price">15$</div>
</div>
<div class="small-images">
<div class="small-image">Some image here</div>
<div class="small-image">Some image here</div>
</div>
<div class="see-item">
<a href="#">click here to see item</a>
</div>
</div>
</div>
</li>
<li class="li-item">
<div class="li-item-inner">
<div class="heading">
<div class="title">Some title text</div>
<div class="subtitle">Title subtitle goes here</div>
</div>
<a href="#" class="photo"><div class="img">Picture here...</div></a>
<div class="details">
<div class="price">
<div class="item-price">15$</div>
</div>
<div class="small-images">
<div class="small-image">Some image here</div>
<div class="small-image">Some image here</div>
</div>
<div class="see-item">
<a href="#">click here to see item</a>
</div>
</div>
</div>
</li>
<li class="li-item">
<div class="li-item-inner">
<div class="heading">
<div class="title">Some title text</div>
<div class="subtitle">Title subtitle goes here</div>
</div>
<a href="#" class="photo"><div class="img">Picture here...</div></a>
<div class="details">
<div class="price">
<div class="item-price">15$</div>
</div>
<div class="small-images">
<div class="small-image">Some image here</div>
<div class="small-image">Some image here</div>
</div>
<div class="see-item">
<a href="#">click here to see item</a>
</div>
</div>
</div>
</li>
<li class="li-item">
<div class="li-item-inner">
<div class="heading">
<div class="title">Some title text</div>
<div class="subtitle">Title subtitle goes here</div>
</div>
<a href="#" class="photo"><div class="img">Picture here...</div></a>
<div class="some-extra-block">
Some extra info for some li-item
</div>
<div class="details">
<div class="price">
<div class="before-price">Some text</div>
<div class="item-price">15$</div>
</div>
<div class="small-images">
<div class="small-image">Some image here</div>
<div class="small-image">Some image here</div>
</div>
<div class="see-item">
<a href="#">click here to see item</a>
</div>
</div>
</div>
</li>
</ul>