前端

How Smart Tools Are Shaping the Future of Creative Work

Eric Chuang
2020-10-29

表單元素非常依賴瀏覽器的定義,因此像是選項按鈕 (radio)、核取方塊 (checkbox) 與下拉式選單 (select) 的樣式在設定樣式時,便時常會需要依賴虛擬元素 (pseudo element)。

作法如下:

See the Pen Customized Radio by Eric Chuang (@eric-chuang) on CodePen.

概念上是在選項按鈕上,用 position: absolute 覆蓋上一層圖層,並針對該圖層設定樣式。這種作法很有可能在不同瀏覽器會有不同的結果,因為瀏覽器預設的選項按鈕起始位置會有 1 到 2 像素 (px) 的差異,因此需要透過 top 與 left 調整自訂圖層的位置。

Sign up for our newsletter

Subscribe to our newsletter to receive the latest updates, expert insights, and practical tips directly in your inbox. Stay informed with content designed to help you grow.

+480.000 happy customers

Gain more with expert solutions

Unlock the full potential of your business with our expert solutions. Our team provides tailored strategies, professional guidance, and actionable insights to help you achieve better results.

  • Eric Chuang
  • •
  • 2025-01-23
如何同時使用 Webinoly 與 Cloudflare 保護網站安全

在社群夥伴勇哥的文章〈Webinoly 最新版快速安裝〉中,提到使用 Webinoly 來建立 WordPre […]

主機