From bb259f79aa2bbccc761061ce095f596dd052a15a Mon Sep 17 00:00:00 2001 From: vitSkalicky Date: Mon, 1 Mar 2021 18:36:27 +0100 Subject: [PATCH] Fix missing checkbox and radio button styles. --- simple.css | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/simple.css b/simple.css index ee185ff..b638742 100644 --- a/simple.css +++ b/simple.css @@ -224,8 +224,12 @@ input[type="submit"]:enabled:hover, input[type="reset"]:focus, input[type="reset"]:enabled:hover, input[type="button"]:focus, -input[type="button"]:enabled:hover { - opacity: .8; +input[type="button"]:enabled:hover, +input[type="checkbox"]:focus, +input[type="checkbox"]:enabled:hover, +input[type="radio"]:focus, +input[type="radio"]:enabled:hover{ + opacity: .8; } /* Format the expanding box */ @@ -308,6 +312,48 @@ input { -webkit-appearance: none; } +/* checkbox and radio button style */ +input[type="checkbox"], input[type="radio"]{ + vertical-align: bottom; + position: relative; +} +input[type="radio"]{ + border-radius: 100%; +} + +input[type="checkbox"]:checked, +input[type="radio"]:checked { + background: var(--accent); +} + +input[type="checkbox"]:checked::after { + /* Creates a rectangle with colored right and bottom borders which is rotated to look like a check mark */ + content: ' '; + width: 0.1em; + height: 0.25em; + border-radius: 0; + position: absolute; + top: 0.05em; + left: 0.18em; + background: transparent; + border-right: solid var(--bg) 0.08em; + border-bottom: solid var(--bg) 0.08em; + font-size: 1.8em; + transform: rotate(45deg); +} +input[type="radio"]:checked::after { + /* creates a colored circle for the checked radio button */ + content: ' '; + width: .25em; + height: .25em; + border-radius: 100%; + position: absolute; + top: 0.125em; + background: var(--bg); + left: 0.125em; + font-size: 32px; +} + /* Make the textarea wider than other inputs */ textarea { width: 80%