[CSS] CSS Value and Processing

Have you ever seen this meme

 

Yes Css doesn't work as your intention but might be there are another reason why your css doesn't work as your goal. 

CSS also have their processing rules!

 

1. Value and Processing

 

 

Can you understand the table? the formal processing way is the css declaration is applied in inner side declarations. 

 

2. How Units Are Converted From Relative To Absolute

This one is more complicated because each property has their own rule.

 

3. What You Need To Know In This Post.

  1. Each Property has initial value, used if nothing is declared
  2. Browsers specify a root-font-size for each page (normally 16px)
  3. Percentage and relative value are always converted to pixels
  4. Percentage are measured to their parents' font-size, if used to specify lengths
  5. em are measured relative to their parent font-size, if used to specify font-size
  6. em are measured relative to their current font-size, if used to specify lengths
  7. rem are always measured relative to the document's root font-size
  8. vh and vw are simply measurement of the viewport's height and width

Leave a Comment

en_USEnglish