donboe
January 18, 2016, 11:44am
1
I have two list items in a row, both holding images. The first one has a width of 30% with a right margin of 5% and the second one has a width of 65% without any margins. How do I get these list items have the same height without declaring a height for the list items?
Thank you in advance
Gandalf
January 18, 2016, 11:57am
2
It would help to see your HTML and CSS. It’s rather difficult to visualise without this.
donboe
January 18, 2016, 12:06pm
3
Hi gandalf. Thanx for the reaction. This is what I have
CSS
.gallery
{
width: 100%;
list-style: none;
word-spacing: -1em;
}
.gallery li
{
width: 30%;
margin-right: 5%;
display: inline-block;
overflow: hidden;
word-spacing: normal;
border: solid 1px #D7DADD;
word-spacing: normal;
}
.gallery li.wide
{
width: 65%;
margin: 0;
}
HTML
<ul class="gallery">
<li>
<img src="/images/model_fotos/m1.jpg"alt=""/>
</li>
<li class="wide">
<img src="/images/model_fotos/m4.jpg"alt=""/>
</li>
</ul>
SamA74
January 18, 2016, 12:08pm
4
So there are only two items in the list? That should make it easier.
donboe
January 18, 2016, 12:10pm
5
Hi Sam thanks. Yes there are indeed
SamA74
January 18, 2016, 12:18pm
6
In that case display: table/table-cell
should do it on the .gallery
and .gallery li
respectively .
m3g4p0p
January 18, 2016, 12:22pm
7
Or just setting the .gallery
to display: flex;
, which may be a bit more, er, flexible especially with responsiveness in mind.
donboe
January 18, 2016, 12:23pm
8
Hi Sam thanks again. I actually try to avoid using the table/table-cell approach because of the margins.
SamA74
January 18, 2016, 12:25pm
9
Flex is looking good then.
donboe
January 18, 2016, 12:27pm
10
Hi m3g. Thanks for the responce. That is what i was thinking after all and yes that is probably the best way to go for. Thanks again
@system thank you for thinking along
system
Closed
April 18, 2016, 7:36pm
11
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.