Skip to content

Instantly share code, notes, and snippets.

@bklik
Created April 10, 2022 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bklik/7970fb29fc19d5cbd3cad7414c16c94d to your computer and use it in GitHub Desktop.
Save bklik/7970fb29fc19d5cbd3cad7414c16c94d to your computer and use it in GitHub Desktop.
* {
box-sizing: border-box;
font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}
html,
body {
height: 100%;
margin: 0;
overflow: auto;
padding: 0;
position: relative;
}
html {
font-size: 8px;
}
body {
align-items: center;
color: #333;
display: grid;
grid-template-columns: 1fr;
font-size: 2rem;
justify-items: center;
}
input,
button {
color: inherit;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
.card {
box-shadow: 0 0.25rem 0.75rem 0.25rem #0003;
border-radius: 1rem;
header {
border-bottom: 1px solid #eee;
margin: 2rem 2rem 4rem 2rem;
padding: 0 0 2rem 0;
h1 {
font-size: 2.5rem;
font-weight: 500;
margin: 0 0 1rem 0;
padding: 0;
}
h2 {
font-size: 2rem;
font-weight: normal;
margin: 0;
padding: 0;
}
}
footer {
border-top: 1px solid #eee;
display: flex;
gap: 2rem;
justify-content: flex-end;
margin: 4rem 0 0 0;
padding: 2rem;
}
}
.password-criteria {
background-color: #eee;
border-radius: 0.5rem;
padding: 1rem;
margin: 0 2rem;
p {
margin: 0 0 1rem 0;
}
ul {
margin: 0 3rem;
padding: 0;
li {
line-height: 3rem;
}
}
}
/* ************************************************
MATERIAL FORM STYLS
************************************************ */
$primary: #0486ff;
$negative: tomato;
form.material {
.form-content {
display: grid;
gap: 4rem;
grid-template-columns: 1fr;
grid-auto-flow: row;
width: 64rem;
max-width: 100%;
}
.field {
display: grid;
grid-template-columns: 1fr;
grid-auto-flow: row;
overflow: visible;
margin: 0 2rem;
position: relative;
label {
color: #999;
position: absolute;
top: 2rem;
transition: all ease 300ms;
}
input {
background-image:
linear-gradient(to bottom, transparent calc(100% - 0.25rem), $primary 0.25rem),
linear-gradient(to bottom, transparent calc(100% - 0.125rem), #ccc 0.125rem);
background-position: center bottom;
background-repeat: no-repeat;
background-size: 0, 100%;
border: none;
outline: none;
padding: 2.5rem 0 1.5rem 0;
transition: all ease 300ms;
&:focus {
background-size: 100%, 100%;
}
&:not(:placeholder-shown) {
background-image:
linear-gradient(to bottom, transparent calc(100% - 0.25rem), $primary 0.25rem),
linear-gradient(to bottom, transparent calc(100% - 0.125rem), #999 0.125rem);
}
&:required + label::after {
color: $negative;
content: ' *';
}
&:not(:placeholder-shown) + label,
&:focus + label {
font-size: 1.5rem;
top: 0;
}
&:focus + label {
color: $primary;
}
}
.hint {
color: #999;
font-size: 1.75rem;
font-weight: 500;
margin: 1rem 0;
}
}
}
button.material {
background: #eee;
background-image: radial-gradient(circle at center, #0003 50%, transparent 50%);
background-repeat: no-repeat;
background-position: center center;
background-size: 0;
border: none;
border-radius: 0.5rem;
box-shadow: 0 0.125rem 0.325rem 0.125rem #0003;
font-weight: 500;
margin: 0;
outline: none;
padding: 1rem 2rem;
transition: all ease 300ms;
text-transform: uppercase;
&:focus {
background-size: 225%;
}
&.flat {
background-color: transparent;
box-shadow: none;
&:focus,
&:hover {
background-color: #eee;
}
}
&.primary {
background-color: $primary;
background-image: radial-gradient(circle at center, #fff3 50%, transparent 50%);
color: #eee;
&:focus,
&:hover {
box-shadow: 0 0.125rem 0.325rem 0.125rem #0009;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment