Friday 20 March 2015

Use of percentage and px and Em Vs Percent in css

CSS has four different unit sizes you can use for your margins, borders, fonts, etc. These are pixels(px), points(pt), ems (em) percentages (%).

We can separate these units in tow different groups , fixed and relative. Pixels(px) and points (pt) are fixed whereas em and percents(%) are relative unit size. Relative unit sizes are really powerful when creating scalable layouts. Fixed size units are good to use when you always want the same element size no matter where you place it.


Em Vs Percent 
--------------------

In theory , both the em and the percent units are identical , but in application , they actually have a few minor differences that are important to consider.


When the client browser text size is set to "medium" there is no difference between ems and percent.
when the setting is altered, however, the difference is quite large. On the Smallest setting ems are much smaller than percent, and when on the "Largest" setting,  it's quite the opposite, with ems displaying much larger than percent. 

No comments:

Salesforce CRM vs. Zoho: A Comparative Analysis

Introduction: Selecting the right customer relationship management (CRM) software is crucial for businesses seeking to streamline their sal...