Reputation: 1
I have been trying to add two images under a single div, but they aren't displaying the way I wanted.
I want to have space between the images, which is not happening.
Here is the css,
.sidebarBody {
text-align:center;
padding: 5px;
}
And this is the HTML,
<div class='sidebarBody'>
<img src="r.gif" />
<img src="s.gif" />
</div>
Why isn't the padding working on all sides ? The second image is displayed right after the first without any space.
Any help is appreciated. Thanks.
Upvotes: 0
Views: 5526
Reputation: 4216
Your css does not put any padding around the images, it only tells it to do the enclosing <div>
. Use the following:
.sidebarBody img {
text-align:center;
padding: 5px;
}
This tells the browser to add a 5px padding to every image inside of .sidebarBody
(the div class).
Upvotes: 2