<style type="text/css">
@import url(https://yourweb/example.css); /* 分號不可省略 */
</style>
也可寫在外部 CSS 檔案開頭:
@import url("reset.css");
@import url("layout.css");
/* 之後才寫本檔案規則 */
@charset。@import url("print.css") print;<link>(並行下載)<link rel="stylesheet" href="reset.css">
<link rel="stylesheet" href="layout.css" media="screen">
<link rel="stylesheet" href="print.css" media="print">
Webpack / Vite / Rollup 等將多 CSS 合併、壓縮、哈希命名,單一請求載入。
組件級作用域,避免全域污染,建構時自動處理依賴。
**生產環境請勿使用 @import**。僅在快速原型、CodePen 等無建構流程場景下暫時使用。