front-end-interview-handbook/packages/quiz/questions/have-you-played-around-with.../zh-CN.mdx

10 lines
762 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 你玩过新的 CSS Flexbox 或 Grid 规范吗?
---
Flexbox 主要用于一维布局,而 Grid 用于二维布局。
Flexbox 解决了 CSS 中的许多常见问题,例如在容器内垂直居中元素、粘性页脚等。著名的 CSS 框架,如 Bootstrap 和 Bulma都基于 Flexbox而 Flexbox 仍然是创建各种布局的经过测试和验证的方法。
Grid 适用于二维布局,让您可以完全控制行和列。它提供了一种直观而强大的方式,可以直接在 CSS 中创建复杂的基于网格的设计,通常比旧技术使用更少的代码和更大的灵活性。现在,所有主要的现代浏览器都对 Grid 提供了强大的支持,这使其成为大多数项目中布局设计的可靠选择。