Skip to content

Commit bb3a74f

Browse files
author
Tino Mettler
committed
CSS cleanup, separate functional and visual CSS code
Added file style.css which is aimed to contain CSS code that affects the look of the gallery. This could be extended to provide different or user-modified styles to give each gallery an individual look.
1 parent b0373f7 commit bb3a74f

File tree

4 files changed

+83
-87
lines changed

4 files changed

+83
-87
lines changed

data/website_gallery/css/gallery.css

Lines changed: 4 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -16,50 +16,27 @@
1616
*/
1717

1818
body {
19-
font-family: system-ui, Arial, Helvetica, sans-serif;
20-
background-color: rgb(238, 240, 242);
19+
width: 100vw;
20+
height: 100vh;
21+
display: flex;
22+
flex-direction: column;
2123
}
2224

2325
.heading h1 {
2426
text-align: center;
25-
background-color: #cdd;
26-
color: black;
2727
display: grid;
2828
}
2929

30-
.heading h1:after {
31-
content: " ";
32-
border-bottom: 1px solid #888888;
33-
height: 1px;
34-
}
35-
3630
.gallery {
3731
display: flex;
3832
flex-wrap: wrap;
3933
justify-content: center;
4034
align-items: center;
41-
gap: 3vw;
42-
margin: 3vw auto;
43-
padding: 1.5vw;
44-
}
45-
46-
.slider {
47-
margin: 0;
48-
padding: 0;
4935
}
5036

51-
5237
.gallery img {
5338
cursor: pointer;
5439
object-fit: contain;
55-
background: none;
56-
padding: 0;
57-
border: 1px outset #737780;
58-
59-
}
60-
61-
.gallery img:hover {
62-
transform: scale(1.08);
6340
}
6441

6542
.thumb {
@@ -76,38 +53,4 @@ body {
7653
align-items: center;
7754
object-fit: contain;
7855
justify-content: center;
79-
background: none;
80-
box-shadow: 0 1vw 4vw 1vw rgba(0,0,0,0.6);
81-
}
82-
83-
.navgrid {
84-
font-size: 3.5vh;
85-
display: grid;
86-
grid-template-columns: 4em 1fr 1.5em 1.5em 1fr 1.5em 1.5em;
87-
grid-column-gap: 1vw;
88-
background-color: black;
89-
}
90-
91-
.nav {
92-
height: 5vh;
93-
background-color: rgba(60,60,60, 0.4);
94-
justify-content: center;
95-
align-items: center;
96-
display: flex;
97-
z-index: 1001;
98-
color: #ccc;
99-
}
100-
101-
.counter {
102-
font-size: 2.5vh;
103-
}
104-
105-
.button {
106-
cursor: pointer;
107-
}
108-
109-
.button:hover {
110-
cursor: pointer;
111-
color: white;
112-
text-shadow: 0px 0px 10px #ccc;
11356
}

data/website_gallery/css/modal.css

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@
2020
padding: 0;
2121
box-sizing: border-box;
2222
}
23-
body {
24-
margin: 0;
25-
padding: 0;
26-
width: 100vw;
27-
height: 100vh;
28-
background: #000;
29-
display: flex;
30-
flex-direction: column;
31-
}
3223

3324
.viewer {
3425
position: relative;
@@ -39,10 +30,20 @@ body {
3930
display: none;
4031
}
4132

33+
.navgrid {
34+
display: grid;
35+
}
36+
37+
.nav {
38+
justify-content: center;
39+
align-items: center;
40+
display: flex;
41+
z-index: 1001;
42+
}
43+
4244
.slider {
4345
position: relative;
4446
width: 100vw;
45-
height: 95vh;
4647
touch-action: none;
4748
overflow: hidden;
4849
}
@@ -69,8 +70,6 @@ body {
6970
will-change: contents;
7071
overflow: hidden;
7172
position: relative;
72-
padding: 0;
73-
margin: 0;
7473
touch-action: none;
7574
object-fit: contain;
7675
}
@@ -80,8 +79,6 @@ body {
8079
max-height: 100%;
8180
width: auto;
8281
height: auto;
83-
padding: 0;
84-
margin: 0;
8582
display: block;
8683
transform-origin: 0 0;
8784
cursor: zoom-in;
@@ -98,15 +95,3 @@ body {
9895
transition: transform 0.2s ease-out;
9996
}
10097

101-
.nav-bar {
102-
width: 100vw;
103-
height: 5vh;
104-
background: #333;
105-
color: #fff;
106-
display: flex;
107-
align-items: center;
108-
padding-left: 20px;
109-
box-sizing: border-box;
110-
font-family: Arial, sans-serif;
111-
font-size: 16px;
112-
}

data/website_gallery/css/style.css

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
body {
2+
font-family: system-ui, Arial, Helvetica, sans-serif;
3+
background-color: rgb(238, 240, 242);
4+
}
5+
6+
.heading h1 {
7+
background-color: #cdd;
8+
color: black;
9+
}
10+
11+
.heading h1:after {
12+
content: " ";
13+
border-bottom: 1px solid #888888;
14+
height: 1px;
15+
}
16+
17+
.gallery {
18+
gap: 3vw;
19+
margin: 3vw auto;
20+
padding: 1.5vw;
21+
}
22+
23+
.gallery img {
24+
background: none;
25+
border: 1px outset #737780;
26+
27+
}
28+
29+
.gallery img:hover {
30+
transform: scale(1.08);
31+
}
32+
33+
.thumb-box {
34+
background: none;
35+
box-shadow: 0 1vw 4vw 1vw rgba(0,0,0,0.6);
36+
}
37+
38+
.nav {
39+
height: 5vh;
40+
background-color: rgba(60,60,60, 0.4);
41+
color: #ccc;
42+
}
43+
44+
.slider {
45+
height: 95vh; /* remaining vh after nav vh */
46+
}
47+
48+
.navgrid {
49+
grid-template-columns: 4em 1fr 1.5em 1.5em 1fr 1.5em 1.5em;
50+
font-size: 3.5vh;
51+
grid-column-gap: 1vw;
52+
background-color: black;
53+
}
54+
55+
.button {
56+
cursor: pointer;
57+
}
58+
59+
.button:hover {
60+
cursor: pointer;
61+
color: white;
62+
text-shadow: 0px 0px 10px #ccc;
63+
}
64+
65+
.counter {
66+
font-size: 2.5vh;
67+
}

data/website_gallery/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0">
77
<link rel="stylesheet" href="css/modal.css">
88
<link rel="stylesheet" href="css/gallery.css">
9+
<link rel="stylesheet" href="css/style.css">
910
<title id="page-title">Image Gallery</title>
1011

1112

0 commit comments

Comments
 (0)