Câu hỏi phỏng vấn CSS
Câu hỏi

What’s the difference between resetting and normalizing CSS? Which would you
choose, and why?

Câu trả lời

The difference between resetting and normalizing CSS lies primarily in their approach to handling browser defaults and achieving consistency across different browsers.

Resetting CSS

Resetting CSS involves stripping away all the default styling provided by browsers. This includes margins, paddings, font sizes, and other properties that browsers apply to HTML elements by default. The main goal of a CSS reset is to provide a clean slate from which to start styling, ensuring that all elements have the same baseline appearance before any custom styles are applied. This approach is beneficial when you want complete control over the styling of all elements and do not wish to rely on any default browser styling[1][2][5][6][11].

Normalizing CSS

Normalizing CSS, on the other hand, aims to make built-in browser styling consistent across different browsers without removing all default styles. It corrects common bugs and inconsistencies found in default browser styles and preserves useful defaults rather than "unstyling" everything. This means that elements like <sup> or <sub> will still appear correctly without additional styling. Normalize.css is particularly useful when you want to build upon a consistent, cross-browser foundation while still taking advantage of some of the browser's styling[1][2][3][4][5][9].

Which to Choose and Why

The choice between resetting and normalizing CSS depends on the specific needs of your project and your workflow preferences.

  • Choose Resetting CSS if:

    • You require complete control over the styling and do not want any interference from browser defaults.
    • Your design is highly customized, where you plan to explicitly define styles for all elements used in the project.
    • You are comfortable redefining common properties for elements from scratch to ensure consistency[1][5][6][11].
  • **Choose Normalizin...

middle

middle

Gợi ý câu hỏi phỏng vấn

junior

List out the key features for Sass

senior

Explain the purpose of clearing floats in CSS

middle

How is responsive design different from adaptive design?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào