40 questions with answers
CSS questions test whether you understand how the browser lays out a page, not whether you have memorised properties. These questions cover the box model, specificity and the cascade, flexbox and grid, positioning and stacking contexts, and responsive and accessible styling.
5.Can you explain the difference between coding a website to be responsive versus using a mobile-first strategy?
Note that these two approaches are not exclusive.
6.Can you give an example of an @media property other than screen?
Yes, there are four types of @media properties (including screen):
14.Describe what you like and dislike about the CSS preprocessors you have used.
- Mostly the advantages mentioned above.
22.Have you played around with the new CSS Flexbox or Grid specs?
Yes. Flexbox is mainly meant for 1-dimensional layouts while Grid is meant for 2-dimensional layouts.
27.How would you implement a web design comp that uses non-standard fonts?
Use @font-face and define font-family for different font-weights.
31.What are the advantages/disadvantages of using CSS preprocessors?
- CSS is made more maintainable.
32.What are the different ways to visually hide content (and make it available only for screen readers)?
These techniques are related to accessibility (a11y).
33.What are the various clearing techniques and which is appropriate for what context?
- Empty div method - <div style="clear:both;"</div.
34.What does * { box-sizing: border-box; } do? What are its advantages?
- By default, elements have box-sizing: content-box applied, and only the content size is being accounted for.
37.What is the CSS display property and can you give a few examples of its use?
- none, block, inline, inline-block, flex, grid, table, table-row, table-cell, list-item.