Reputation: 131
I have two images and would like to place one on top of another using a list. The current code I'm using places the second image to the right of the first one, not directly below it.
Any ideas? Might be basic but I'm new to programming. Thanks.
<ul>
<li>
<img width="178" height="178" alt="ZE40" src="images/ze40.jpg">
<img width="178" height="40" alt="ZE40" src="images/ze40i.jpg">
</li>
</ul>
Upvotes: 0
Views: 80
Reputation: 13914
You should try this:
<ul>
<li>
<img width="178" height="178" alt="ZE40" src="images/ze40.jpg">
</li>
<li>
<img width="178" height="40" alt="ZE40" src="images/ze40i.jpg">
</li>
</ul>
To remove the space between them you can do this in your CSS:
ul, li {
margin: 0;
padding: 0;
}
Upvotes: 0
Reputation: 207861
There are two basic options here:
img {
display:block;
}
<ul>
<li>
<img width="178" height="178" alt="ZE40" src="images/ze40.jpg" />
</li>
<li>
<img width="178" height="40" alt="ZE40" src="images/ze40i.jpg" />
</li>
</ul>
img {
vertical-align:top;
}
Upvotes: 2
Reputation: 102
Just use another <li></li>
for the second image
<ul>
<li>
<img width="178" height="178" alt="ZE40" src="images/ze40.jpg">
</li>
<li>
<img width="178" height="40" alt="ZE40" src="images/ze40i.jpg">
</li>
</ul>
Edit: When you use 2 images on 1 <li>
, it would put 2 images next to each other, but when you use the second, the first one will go on top of the second one just like when you make a list for yourself on a paper.
Upvotes: 0