HTML | Padding in px versus %

Author - Webner

In HTML, padding can be given to the text in following ways:

Method 1:

style=”padding-left:100px;”

or

style=”padding-right:100px;”

Method 2:

style=”padding-left:30%;”

or

style=”padding-right:30%;”

It is more appropriate to use “%” than “px”. The reason for this is when px is used, padding space is fixed on screen of every size. It will look good when the size of the screen is large. But when the same page is viewed on smaller screen, image does not resize or adjust itself accordingly. In other words, responsiveness is not achieved.

When “%” is used, image adjusts to the size of the screen on which page is viewed and responsiveness of the page is not affected.

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *

Send your message