Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is the difference between px,em and percentage in css?

user-image
Question added by Saurav Kumar
Date Posted: 2016/05/13
Sri harsha vardhan Akula
by Sri harsha vardhan Akula , Software Engineer , Veniso Solutions

Pixels (px):

px are browser dependent. It is the absolute size that you would see on your screen.

 

em:

 

Em are sort of like percentages. Ems is referring to the base text size. The value of 1 emmeans the same thing as a value of 100 percent. But you can also say it in the opposite way: A percentage value is just an em multiplied by 100.

Ehsan Ansari
by Ehsan Ansari , Marketing Specialist , Galadari Trucks And Heavy Equipment (JCB)

px stands for pixels, generally use to define dimensions for fonts, pictures, tags, Divs, etc in absolute terms

em is used for sizing fonts in multiple values of the set font size. If font size is set to 12px, it will be 1 em. 2em will be twice the size of the set font i.e 24 px

percentages are generally used for responsive webdesigns to accommodate the design/fonts as per the screen size.

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.