Skip to content

Responsive 设计

一句话解释

Responsive 设计是 方法哪里 website's 布局 and 内容 adapt 到 screen 大小的 device viewing 它.

用大白话说

Responsive design means building websites that look good and work well on all devices — from small phones to large desktop monitors. Instead of creating separate sites for mobile and desktop, you build one site that adapts.

The three core ingredients are: fluid grids (using relative units like % and fr instead of fixed px), flexible images (max-width: 100% so they scale down), and media queries (CSS that applies different styles at different screen widths).

A "mobile-first" approach is recommended: design for mobile first, then enhance for larger screens with min-width media queries. This ensures the mobile experience is not an afterthought and typically results in better performance on mobile devices.

示例

css
/* Mobile-first responsive grid */
.grid { grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid { grid-template-columns: 2fr 1fr; } }

网格那个开始 as one 列 on mobile and becomes two 列 on tablet and larger screens.

相关术语

相关资源

相关课程

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表