Skip to content
This repository was archived by the owner on Sep 25, 2021. It is now read-only.

Commit e3cbc43

Browse files
committed
Demo: Improve layout and design.
This adds support for a light/dark theme based on the OS color scheme setting.
1 parent 259d8fd commit e3cbc43

File tree

2 files changed

+104
-34
lines changed

2 files changed

+104
-34
lines changed

css/demo.css

Lines changed: 97 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,51 +13,120 @@ body {
1313
max-width: 750px;
1414
margin: 0 auto;
1515
padding: 1em;
16-
font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, sans-serif;
17-
font-size: 1em;
18-
line-height: 1.4em;
19-
background: #222;
20-
color: #fff;
21-
-webkit-text-size-adjust: 100%;
22-
-ms-text-size-adjust: 100%;
16+
font-family: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
17+
sans-serif;
18+
line-height: 1.4;
19+
background: #212121;
20+
color: #dedede;
2321
}
2422
a {
25-
color: orange;
23+
color: #61afef;
2624
text-decoration: none;
2725
}
28-
img {
26+
a:visited {
27+
color: #56b6c2;
28+
}
29+
a:hover {
30+
color: #98c379;
31+
}
32+
figure,
33+
tr {
34+
background: #363636;
35+
}
36+
tr:nth-child(odd) {
37+
background: #414141;
38+
}
39+
td,
40+
th {
41+
padding: 10px;
42+
text-align: left;
43+
}
44+
table {
45+
width: 100%;
46+
word-wrap: break-word;
47+
table-layout: fixed;
48+
border-collapse: collapse;
49+
}
50+
figure {
51+
margin: 0;
52+
padding: 10px;
53+
border-radius: 5px;
54+
display: inline-block;
55+
}
56+
figure,
57+
table {
58+
margin-bottom: 20px;
59+
}
60+
img,
61+
canvas {
2962
border: 0;
3063
vertical-align: middle;
3164
}
65+
h1,
66+
h2,
67+
h3,
68+
h4,
69+
h5,
70+
h6 {
71+
margin-top: 1.5em;
72+
margin-bottom: 0.5em;
73+
}
3274
h1 {
33-
line-height: 1em;
75+
margin-top: 0.5em;
3476
}
35-
textarea,
36-
input {
37-
display: inline-block;
38-
width: 100%;
39-
-webkit-box-sizing: border-box;
40-
-moz-box-sizing: border-box;
77+
button,
78+
input,
79+
select,
80+
textarea {
4181
box-sizing: border-box;
42-
padding: 10px;
43-
margin: 0 0 10px;
82+
font-family: inherit;
83+
font-size: 100%;
84+
line-height: 1.15;
85+
margin: 0;
86+
padding: 5px;
87+
}
88+
input[type='file'] {
89+
padding: inherit;
90+
}
91+
92+
@media (prefers-color-scheme: light) {
93+
body {
94+
background: #ececec;
95+
color: #212121;
96+
}
97+
a {
98+
color: #225c8d;
99+
}
100+
a:visited {
101+
color: #378f9a;
102+
}
103+
a:hover {
104+
color: #6fa349;
105+
}
106+
figure,
107+
tr {
108+
background: #fff;
109+
color: #212121;
110+
}
111+
tr:nth-child(odd) {
112+
background: #f6f6f6;
113+
}
114+
}
115+
116+
#input,
117+
#result {
118+
width: 100%;
44119
}
45120

46121
@media (min-width: 481px) {
47-
.navigation {
122+
#navigation {
48123
list-style: none;
49124
padding: 0;
50125
}
51-
.navigation li {
126+
#navigation li {
52127
display: inline-block;
53128
}
54-
.navigation li:not(:first-child):before {
55-
content: '| ';
129+
#navigation li:not(:first-child)::before {
130+
content: ' | ';
56131
}
57132
}
58-
59-
/* IE7 fixes */
60-
* + html textarea,
61-
* + html input {
62-
width: 460px;
63-
}

index.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ <h1>JavaScript MD5 Demo</h1>
3131
JavaScript
3232
<a href="https://en.wikipedia.org/wiki/MD5">MD5</a> implementation.<br />
3333
Compatible with server-side environments like
34-
<a href="http://nodejs.org/">Node.js</a>, module loaders like
35-
<a href="http://requirejs.org/">RequireJS</a>,
36-
<a href="http://browserify.org/">Browserify</a> or
37-
<a href="https://webpack.github.io/">webpack</a> and all web browsers.
34+
<a href="https://nodejs.org/">Node.js</a>, module loaders like
35+
<a href="https://requirejs.org/">RequireJS</a> or
36+
<a href="https://webpack.js.org/">webpack</a> and all web browsers.
3837
</p>
39-
<ul class="navigation">
38+
<ul id="navigation">
4039
<li>
41-
<a href="https://github.com/blueimp/JavaScript-MD5/tags">Download</a>
40+
<a href="https://github.com/blueimp/JavaScript-MD5/releases"
41+
>Download</a
42+
>
4243
</li>
4344
<li>
4445
<a href="https://github.com/blueimp/JavaScript-MD5">Source Code</a>

0 commit comments

Comments
 (0)