Saturday 22 February 2020

Top CSS Interview Questions

These CSS interview questions are based on my personal interview experience. Likelihood of question being asked in the interview is from top to bottom.

1. Do you know about Box model ? What are the different values of box-sizing css?

    Margin-border-padding-content

2. What are the css precedence rules and css specificity ?

Css specificity is the set of rules applied to determine which style is applied to an element.
Order of css specificity from highest to lowest is as follows:-



  • A css rule with !important always takes precedence.
  • If element is having inline style ( element style attribute ) overrides all other styles (1,0,0,0)
  • A css selector using element id (element id attribute) (0,1,0,0)
  • A css selector using class, pseudo class or attribute (0,0,1,0)
  • A css selector using element name (for e.g. h1, p, div) (0,0,0,1)
  • A css selector appear later in the code override earlier one if both have the same specificity
  • Good read to understand how to calculate specificity:- 

    3. Difference between visibility:hidden; and display:none;

    visibilty:hidden element is not visible but space is allocated.
    display:none      element is not displayed and space is not allocated.

    4. How to align a block element inside another element.

    5. Difference between Static, Relative, Absolute and Fixed position

    6. What is shadow dom

    7. Pseudo elements

    ::before
    ::after

    8. Pseudo classes

    :active
    :hover
    :nth-child(n)

    9. Media query in CSS3

    10. em vs rem vs px ? Which unit of measurement you should use and when in css ?




    No comments:

    Post a Comment

    Top CSS Interview Questions

    These CSS interview questions are based on my personal interview experience. Likelihood of question being asked in the interview is from to...