1 reply [Last post]
LisaRe
LisaRe's picture
Offline
newbie
Last seen: 2 years 46 weeks ago
Timezone: GMT+1
Joined: 2017-05-15
Posts: 1
Points: 2

Hello

Sorry is this sounds just too basic for many of you. I have followed a few CSS courses but I can't figure out yet how to add padding to images that I have placed inside a particular oblong div?

I have used Dreamweaver to get them into my template (insert images) but now need to correctly space them as the images sit directly next to each other.

Please advise!

With thanks in anticipation.

LR

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 11 hours 25 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9754
Points: 3836

Margin, not padding

An image element is not a container and cannot have padding. Use the margin property. E.g.

img {
  margin: 0 .5em;
  }
which adds a bit of space to each side of the image but none to the top and bottom.

More specific help will require knowing your specific coding.

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.