Skip to content

Commit

Permalink
📚 create new article (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
splendente committed Feb 9, 2025
1 parent ca3c25c commit 9addcfd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions content/21.option-display-none.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: "Safari で option 要素に display: none; が効かない時の対処法"
description: "要素を非表示にする display: none; を指定したにも関わらず、表示されてしまう時の対処法についてまとめる"
emoji: "🫣"
createdAt: "2025-1-9"
updatedAt: "2025-1-9"
tags: ['HTML', 'CSS', 'Safari']
---

## 対処法

よくある対処法として、span 要素で option 要素を囲み、span 要素に対して display: none; を指定する方法があります。

しかし、select 要素の子要素として span 要素を指定することは HTML の仕様に従わないため、他の方法を模索するべきだと思います。

CSS で指定する方法は諦め、動的に要素を追加したり、削除したりする方法が良いと思います。

0 comments on commit 9addcfd

Please sign in to comment.