CSS 不加载
快速摘要
你的 `<链接>` 标签点 到 CSS file 那个 doesn't exist or 失败到 加载, 所以 page appears unstyled.
为什么发生
错误
hrefpath in<链接>标签CSS file 返回 404
restrictive
mediaattribute prevents stylesheet 从 applying
最小示例
✗ 错误代码
<link rel="stylesheet" href="/css/stlye.css"> // typo✓ 修复代码
<link rel="stylesheet" href="/css/style.css"> path 有 typo (stlye.CSS 相反的 样式.CSS) — 浏览器获取 404 and page appears unstyled.
如何诊断
检查 Network tab for 404 on CSS file
验证
<链接>标签hrefmatches 实际 file path检查
mediaattribute — 做它 match current viewport?
如何修复
正确
hrefpath 到实际 CSS file 位置移除 or fix restrictive
mediaattributeEnsure CSS file 是 deployed and accessible on 服务器
如何预防
Use 构建 tools 到验证 CSS paths 期间构建处理
Keep CSS files in dedicated directory 使用 consistent naming