預覽:
CodePen URL:
GitHub:
說明:
- 自主開發設計。
- 使用不同的 font-awesome 作法。
- 實作CSS Selectors 根據連結關鍵字套用偽類icon。
- 自適應連結清單 navbar。
- 切換黑白風格按鈕。
- 添加進場動畫。
:is()
能減少編譯指定父元素。- 實作IOS切換按鈕。
(疑問紀錄,原先想用 onload
網頁載入時就判斷是否預設 checked
來套用 class
,但失敗。)
找到 :has()
CSS Selectors 就不用綁定JS監聽套用class了。.top-nav:has(input[type=“checkbox”]:checked)
參考: