Back to Home

CSS Interview Questions

July 24, 2015

  1. What is the difference between classes and ID's in CSS?
  2. Both are selector in CSS. ID's specificity is much greater than class. Class can be re-usable.

  3. What's the difference between "resetting" and "normalizing" CSS? Which would you choose, and why?
  4. Describe Floats and how they work.

    Float is the position element that can have value of right and left. Overfloating can be prevent by set up 'clear:both'.

  5. Describe z-index and how stacking context is formed.
  6. z-index is for proirty order. The greater number is latest stak- thus come at front

  7. Describe BFC(Block Formatting Context) and how it works.
  8. What are the various clearing techniques and which is appropriate for what context?
  9. clear:both can clear floating element.

  10. Explain CSS sprites, and how you would implement them on a page or site.
  11. What are your favourite image replacement techniques and which do you use when?
  12. How would you approach fixing browser-specific styling issues?
  13. How do you serve your pages for feature-constrained browsers?
  14. What techniques/processes do you use?
  15. What are the different ways to visually hide content (and make it available only for screen readers)?
  16. Have you ever used a grid system, and if so, what do you prefer?
  17. Have you used or implemented media queries or mobile specific layouts/CSS?
  18. Are you familiar with styling SVG?
  19. How do you optimize your webpages for print?
  20. What are some of the "gotchas" for writing efficient CSS?
  21. What are the advantages/disadvantages of using CSS preprocessors?
  22. Describe what you like and dislike about the CSS preprocessors you have used.
  23. How would you implement a web design comp that uses non-standard fonts?
  24. Explain how a browser determines what elements match a CSS selector.
  25. Describe pseudo-elements and discuss what they are used for.
  26. Pseudo-elements like before, after, first-letter will help to select elements partially. It is also distinguished by using '::'.

  27. Explain your understanding of the box model and how you would tell the browser in CSS to render your layout in different box models.
  28. What does * { box-sizing: border-box; } do? What are its advantages?
  29. List as many values for the display property that you can remember.
  30. display: none

  31. What's the difference between inline and inline-block?
  32. inline does not working with padding-bottom and top property. But inline-block does

  33. What's the difference between a relative, fixed, absolute and statically positioned element?
  34. The 'C' in CSS stands for Cascading. How is priority determined in assigning styles (a few examples)? How can you use this system to your advantage?
  35. If you determine rule later on the css, it will be override the previous role. Bigger specificity always goes priority in styling. For instance ID and class.

  36. What existing CSS frameworks have you used locally, or in production? How would you change/improve them?
  37. Have you played around with the new CSS Flexbox or Grid specs?
  38. How is responsive design different from adaptive design?
  39. Have you ever worked with retina graphics? If so, when and what techniques did you use?
  40. Is there any reason you'd want to use translate() instead of absolute positioning, or vice-versa? And why?