_form.scss (5933B)
1 /// 2 /// Dimension by HTML5 UP 3 /// html5up.net | @ajlkn 4 /// Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) 5 /// 6 7 /* Form */ 8 9 form { 10 margin: 0 0 _size(element-margin) 0; 11 12 > :last-child { 13 margin-bottom: 0; 14 } 15 16 > .fields { 17 $gutter: (_size(element-margin) * 0.75); 18 19 @include vendor('display', 'flex'); 20 @include vendor('flex-wrap', 'wrap'); 21 width: calc(100% + #{$gutter * 2}); 22 margin: ($gutter * -1) 0 _size(element-margin) ($gutter * -1); 23 24 > .field { 25 @include vendor('flex-grow', '0'); 26 @include vendor('flex-shrink', '0'); 27 padding: $gutter 0 0 $gutter; 28 width: calc(100% - #{$gutter * 1}); 29 30 &.half { 31 width: calc(50% - #{$gutter * 0.5}); 32 } 33 34 &.third { 35 width: calc(#{100% / 3} - #{$gutter * (1 / 3)}); 36 } 37 38 &.quarter { 39 width: calc(25% - #{$gutter * 0.25}); 40 } 41 } 42 } 43 44 @include breakpoint('<=xsmall') { 45 > .fields { 46 $gutter: (_size(element-margin) * 0.75); 47 48 width: calc(100% + #{$gutter * 2}); 49 margin: ($gutter * -1) 0 _size(element-margin) ($gutter * -1); 50 51 > .field { 52 padding: $gutter 0 0 $gutter; 53 width: calc(100% - #{$gutter * 1}); 54 55 &.half { 56 width: calc(100% - #{$gutter * 1}); 57 } 58 59 &.third { 60 width: calc(100% - #{$gutter * 1}); 61 } 62 63 &.quarter { 64 width: calc(100% - #{$gutter * 1}); 65 } 66 } 67 } 68 } 69 } 70 71 label { 72 color: _palette(fg-bold); 73 display: block; 74 font-size: 0.8rem; 75 font-weight: _font(weight); 76 letter-spacing: _font(letter-spacing); 77 line-height: 1.5; 78 margin: 0 0 (_size(element-margin) * 0.5) 0; 79 text-transform: uppercase; 80 } 81 82 input[type="text"], 83 input[type="password"], 84 input[type="email"], 85 input[type="tel"], 86 select, 87 textarea { 88 @include vendor('appearance', 'none'); 89 @include vendor('transition', ( 90 'border-color #{_duration(transition)} ease-in-out', 91 'box-shadow #{_duration(transition)} ease-in-out', 92 'background-color #{_duration(transition)} ease-in-out' 93 )); 94 background-color: transparent; 95 border-radius: _size(border-radius); 96 border: solid _size(border-width) _palette(border); 97 color: inherit; 98 display: block; 99 outline: 0; 100 padding: 0 1rem; 101 text-decoration: none; 102 width: 100%; 103 104 &:invalid { 105 box-shadow: none; 106 } 107 108 &:focus { 109 background: _palette(border-bg); 110 border-color: _palette(fg-bold); 111 box-shadow: 0 0 0 _size(border-width) _palette(fg-bold); 112 } 113 } 114 115 select { 116 background-image: svg-url("<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' preserveAspectRatio='none' viewBox='0 0 40 40'><path d='M9.4,12.3l10.4,10.4l10.4-10.4c0.2-0.2,0.5-0.4,0.9-0.4c0.3,0,0.6,0.1,0.9,0.4l3.3,3.3c0.2,0.2,0.4,0.5,0.4,0.9 c0,0.4-0.1,0.6-0.4,0.9L20.7,31.9c-0.2,0.2-0.5,0.4-0.9,0.4c-0.3,0-0.6-0.1-0.9-0.4L4.3,17.3c-0.2-0.2-0.4-0.5-0.4-0.9 c0-0.4,0.1-0.6,0.4-0.9l3.3-3.3c0.2-0.2,0.5-0.4,0.9-0.4S9.1,12.1,9.4,12.3z' fill='#{_palette(border)}' /></svg>"); 117 background-size: 1.25rem; 118 background-repeat: no-repeat; 119 background-position: calc(100% - 1rem) center; 120 height: _size(element-height); 121 padding-right: _size(element-height); 122 text-overflow: ellipsis; 123 124 option { 125 color: _palette(fg); 126 background: _palette(bg); 127 } 128 129 &:focus { 130 &::-ms-value { 131 background-color: transparent; 132 } 133 } 134 135 &::-ms-expand { 136 display: none; 137 } 138 } 139 140 input[type="text"], 141 input[type="password"], 142 input[type="email"], 143 select { 144 height: _size(element-height); 145 } 146 147 textarea { 148 padding: 0.75rem 1rem; 149 } 150 151 input[type="checkbox"], 152 input[type="radio"], { 153 @include vendor('appearance', 'none'); 154 display: block; 155 float: left; 156 margin-right: -2rem; 157 opacity: 0; 158 width: 1rem; 159 z-index: -1; 160 161 & + label { 162 @include icon(false, solid); 163 @include vendor('user-select', 'none'); 164 color: _palette(fg); 165 cursor: pointer; 166 display: inline-block; 167 font-size: 0.8rem; 168 font-weight: _font(weight); 169 margin: 0 0 (_size(element-margin) * 0.25) 0; 170 padding-left: (_size(element-height) * 0.6) + 1rem; 171 padding-right: 0.75rem; 172 position: relative; 173 174 &:before { 175 @include vendor('transition', ( 176 'border-color #{_duration(transition)} ease-in-out', 177 'box-shadow #{_duration(transition)} ease-in-out', 178 'background-color #{_duration(transition)} ease-in-out' 179 )); 180 border-radius: _size(border-radius); 181 border: solid _size(border-width) _palette(border); 182 content: ''; 183 display: inline-block; 184 height: (_size(element-height) * 0.6); 185 left: 0; 186 line-height: (_size(element-height) * 0.6); 187 //line-height: calc(#{_size(element-height) * 0.6} + 0em); 188 position: absolute; 189 text-align: center; 190 top: -0.15rem; 191 width: (_size(element-height) * 0.6); 192 } 193 } 194 195 &:checked + label { 196 &:before { 197 background: _palette(fg-bold) !important; 198 border-color: _palette(fg-bold) !important; 199 color: _palette(bg); 200 content: '\f00c'; 201 } 202 } 203 204 &:focus + label { 205 &:before { 206 background: _palette(border-bg); 207 border-color: _palette(fg-bold); 208 box-shadow: 0 0 0 _size(border-width) _palette(fg-bold); 209 } 210 } 211 } 212 213 input[type="checkbox"] { 214 & + label { 215 &:before { 216 border-radius: _size(border-radius); 217 } 218 } 219 } 220 221 input[type="radio"] { 222 & + label { 223 &:before { 224 border-radius: 100%; 225 } 226 } 227 } 228 229 ::-webkit-input-placeholder { 230 color: _palette(fg-light) !important; 231 opacity: 1.0; 232 } 233 234 :-moz-placeholder { 235 color: _palette(fg-light) !important; 236 opacity: 1.0; 237 } 238 239 ::-moz-placeholder { 240 color: _palette(fg-light) !important; 241 opacity: 1.0; 242 } 243 244 :-ms-input-placeholder { 245 color: _palette(fg-light) !important; 246 opacity: 1.0; 247 } 248 249 .formerize-placeholder { 250 color: _palette(fg-light) !important; 251 opacity: 1.0; 252 }