Skip to content

Commit da05026

Browse files
committed
Demo: Add button press effect and refactor styles.
1 parent b0c5a3a commit da05026

File tree

2 files changed

+28
-21
lines changed

2 files changed

+28
-21
lines changed

css/demo.css

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,22 @@ textarea {
106106
display: block;
107107
overflow: auto;
108108
}
109+
button {
110+
background: #3c76a7;
111+
background: linear-gradient(180deg, #3c76a7, #225c8d);
112+
border-color: #225c8d;
113+
color: #fff;
114+
}
115+
button[type='submit'] {
116+
background: #6fa349;
117+
background: linear-gradient(180deg, #6fa349, #568a30);
118+
border-color: #568a30;
119+
}
120+
button[type='reset'] {
121+
background: #d79435;
122+
background: linear-gradient(180deg, #d79435, #be7b1c);
123+
border-color: #be7b1c;
124+
}
109125
select {
110126
display: block;
111127
padding-right: 2.25em;
@@ -116,6 +132,10 @@ select {
116132
border-color: #225c8d;
117133
color: #fff;
118134
}
135+
button:active,
136+
select:active {
137+
box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
138+
}
119139
select::-ms-expand {
120140
display: none;
121141
}
@@ -151,6 +171,9 @@ input[type='file']::-webkit-file-upload-button {
151171
border-radius: 5px;
152172
box-shadow: 0 0 4px rgba(0, 0, 0, 0.07);
153173
}
174+
input[type='file']::-webkit-file-upload-button:active {
175+
box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
176+
}
154177
input[type='file']::-ms-browse {
155178
box-sizing: border-box;
156179
margin: 0;
@@ -164,6 +187,9 @@ input[type='file']::-ms-browse {
164187
border-radius: 5px;
165188
box-shadow: 0 0 4px rgba(0, 0, 0, 0.07);
166189
}
190+
input[type='file']::-ms-browse:active {
191+
box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
192+
}
167193

168194
@media (prefers-color-scheme: light) {
169195
body {
@@ -195,25 +221,6 @@ input[type='file']::-ms-browse {
195221
}
196222
}
197223

198-
#edit {
199-
background: #3c76a7;
200-
background: linear-gradient(180deg, #3c76a7, #225c8d);
201-
border-color: #225c8d;
202-
color: #fff;
203-
}
204-
#crop {
205-
background: #6fa349;
206-
background: linear-gradient(180deg, #6fa349, #568a30);
207-
border-color: #568a30;
208-
color: #fff;
209-
}
210-
#cancel {
211-
background: #d79435;
212-
background: linear-gradient(180deg, #d79435, #be7b1c);
213-
border-color: #be7b1c;
214-
color: #fff;
215-
}
216-
217224
#result {
218225
display: block;
219226
}

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ <h3>Options</h3>
118118
<h2>Result</h2>
119119
<p id="actions" style="display: none;">
120120
<button type="button" id="edit">Edit</button>
121-
<button type="button" id="crop">Crop</button>
122-
<button type="button" id="cancel">Cancel</button>
121+
<button type="submit" id="crop">Crop</button>
122+
<button type="reset" id="cancel">Cancel</button>
123123
</p>
124124
<figure id="result">
125125
<figcaption style="display: none;">

0 commit comments

Comments
 (0)