非活性ラジオボタンのスタイルを設定する
目次
概要
非活性のラジオボタンは薄色表示されますが、活性ボタンとの違いがあまり目立たないことがあります。CSS を用いて非活性のラジオボタンのスタイルを変更する方法を紹介します。
ソース
デフォルトのラジオボタンの上に radius を用いた円を上書きしています。
input[type="radio"]:disabled::after {
position: absolute;
content: "";
width: .9em;
height: .9em;
border: 1px solid #999;
border-radius: 50%;
background-color: #aaa;
}
実行サンプル
非活性のラジオボタンが少し目立つようになりました。(※Chrome, Edge, Opera では利用できますが、Firefox だとうまく効かないようです)
Copyright (C) 2024 杜甫々
初版:2024年9月1日 最終更新:2024年9月1日
https://www.tohoho-web.com/how2/disabled-radio-style.html