The first image class name, noPadding, and second image class name padding have been taken in HTML code in the above code.
In CSS code, the noPadding class has without padding with a 5px border. No padding does not give any space around the image. It strictly sticks to the border. You can see it in the above 1stimage.
The padding class has padding 75px 50px and 5px border. Due to this, padding around the image’s top and bottom is 50px, and the left and right are 50px, respectively. We have seen some space from the border. You can see it in the 2ndimage.
Example #4 – Image Padding with a Single Padding Value
The first image class name, noPadding, and second image class name padding have been taken in HTML code in the above code.
In CSS code, the noPadding class has without padding with a 5px border. No padding does not give any space around the image. It strictly sticks to the border. You can see it in the above 1stimage.
The padding class has a padding of 70 and a 5px border. Due to this, we were padding around the image top, left, right and bottom 70px around, respectively. We have seen some space from the border. You can see it in the 2ndimage.
If we want to apply only particular side padding, then CSS provides predefined properties:
Padding-left:10px: apply padding 10px to the left side.
Padding-right:10px: apply padding 10px to the right side.
Padding-top:10px: apply padding 10px to the top side.