In this article, i will show you some hacks to prevent your web page from lagging. The problem is when you have to many images in your web page, your content shift downwards as soon as the image gets loaded and this will irritate your audience. This happens because browser don’t know that how much space a image will occupy & when image gets loaded into browser it will shift your content downwards.
here is the problem
The formula to find padding is given below
Padding Bottom = (Image Height / Image Width) * 100%
In my case, the image size are 1920 x 1200 px. So, the padding should bePadding Bottom = (1200 / 1920) * 100%
Padding Bottom = 62.5%
To make your web page responsive we will assign the padding in percentage, so that it can leave a perfect space in every resolutions.
We also need to assign position: absolute to the image, and position: relative to the wrapper, to ensure the padding is not added to the height of the image when the browser calculates the wrapper's height.



No comments:
Post a Comment