From 38e958620b54734af20441610867d5bb707d2ba3 Mon Sep 17 00:00:00 2001 From: Jordan Scales Date: Fri, 17 Apr 2020 14:36:38 -0400 Subject: [PATCH] radio buttons --- docs/index.html | 29 +++++++++++++++++++++++++++-- radio-border-disabled.svg | 7 +++++++ radio-border.svg | 8 ++++++++ radio-dot-disabled.svg | 3 +++ radio-dot.svg | 3 +++ style.css | 39 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 radio-border-disabled.svg create mode 100644 radio-border.svg create mode 100644 radio-dot-disabled.svg create mode 100644 radio-dot.svg diff --git a/docs/index.html b/docs/index.html index 3f4bb2f..9c03302 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,15 +33,20 @@
I think it's
- +
- +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
diff --git a/radio-border-disabled.svg b/radio-border-disabled.svg new file mode 100644 index 0000000..fd003cd --- /dev/null +++ b/radio-border-disabled.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/radio-border.svg b/radio-border.svg new file mode 100644 index 0000000..633be90 --- /dev/null +++ b/radio-border.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/radio-dot-disabled.svg b/radio-dot-disabled.svg new file mode 100644 index 0000000..7d59f52 --- /dev/null +++ b/radio-dot-disabled.svg @@ -0,0 +1,3 @@ + + + diff --git a/radio-dot.svg b/radio-dot.svg new file mode 100644 index 0000000..61b884d --- /dev/null +++ b/radio-dot.svg @@ -0,0 +1,3 @@ + + + diff --git a/style.css b/style.css index ce0f54a..cb60bba 100644 --- a/style.css +++ b/style.css @@ -11,6 +11,7 @@ /* Spacing */ --element-spacing: 8px; --grouped-element-spacing: 4px; + --radio-label-spacing: 6px; /* Borders */ --border-width: 1px; @@ -169,3 +170,41 @@ legend { .field-row-stacked * + * { margin-top: var(--grouped-element-spacing); } + +label { + display: flex; + align-items: center; +} +input[type="radio"]:focus + label { + outline: 1px dotted #000000; +} +input[type="radio"] { + display: none; +} +input[type="radio"] + label { + position: relative; +} +input[type="radio"] + label::before { + content: ""; + display: inline-block; + width: 12px; + height: 12px; + margin-right: var(--radio-label-spacing); + background: url("./radio-border.svg"); +} +input[type="radio"]:checked + label::after { + content: ""; + display: block; + width: 4px; + height: 4px; + top: 4px; + left: 4px; + position: absolute; + background: url("./radio-dot.svg"); +} +input[type="radio"][disabled] + label::before { + background: url("./radio-border-disabled.svg"); +} +input[type="radio"][disabled]:checked + label::after { + background: url("./radio-dot-disabled.svg"); +}