summaryrefslogtreecommitdiff
path: root/resources/css.org
blob: 2067f02a519e59e5c683a07a3926f5b19146ce26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# -*- mode: org; -*-

#+TITLE: Global CSS file
#+SUBTITLE: Site-wide styling informations.
#+AUTHOR: Marius Peter
#+DATE: <2022-01-30 Sun>
#+OPTIONS: toc:nil
#+PROPERTY: header-args :tangle mlnp.css

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="mlnp.css" />
#+INCLUDE: topnav.org
#+TOC: headlines 3


* Global appearance

These styles apply across the entire =mlnp.fr= website, to every
element.

#+BEGIN_SRC css
  body {
      font-family: "Public Sans", sans-serif;
      background: linear-gradient(0deg, white 0%, gray 70%);
      background-attachment: fixed;
      margin: 0;
  }
#+END_SRC


** Colors

These colors can be accessed anywhere in the rest of the stylesheet.

#+NAME: colors
#+BEGIN_SRC css
  :root {
      --topnav: cornflowerblue;
      --topnav-menu: royalblue;
  }
#+END_SRC


** TODO Fonts

Add @ rules and set

#+NAME: fonts
#+BEGIN_SRC css
  code, .src {
      font-family: "Hack", sans-serif;
  }
#+END_SRC



** Entire content

This rule concerns all content except for the title section and
postamble.

#+BEGIN_SRC css
  .outline-2, .abstract {
      width: 70%;
      margin-right: auto;
      margin-left: auto;
  }
#+END_SRC


** Title and subtitle

#+BEGIN_SRC css
  .title {
      background: cornflowerblue;
      color: white;
      margin-top: 0;
      padding-top: 0.5em;
      margin-bottom: 0;
      padding-bottom: 0;
  }
  .subtitle {
      color: lightgray;
  }
#+END_SRC


** Table of contents

#+BEGIN_SRC css
  #table-of-contents {
      width: 20%;
      /* position: sticky; */
      top: 5em;
      display: inline-block;
      vertical-align: top;
  }
  #text-table-of-contents ul {
      list-style-type: none;
      padding: 0;
  }
#+END_SRC


* Top navigation bar

The HTML preamble contains a single child: the /navigation bar/. This
bar contains a link to the homepage, and links to the other top-level
website pages.

#+NAME: navbar
#+BEGIN_SRC css
  #topnav {
      background: var(--topnav);
      z-index: 100;
      position: sticky;
      top: 0;
  }
#+END_SRC


** Wide screens

#+BEGIN_SRC css
  #topnav ul {
      display: flex;
      list-style-type: none;
      justify-content: center;
      padding: 0.5em;
      margin: 0;
  }
  #topnav ul a {
      /* flex-grow: 1; */
      /* flex-basis: 0; */
      padding: 0.5em;
      color: lightgray;
      text-align: center;
  }
  #topnav a:hover {
      background: white;
      color: var(--topnav-menu);
  }
#+END_SRC


*** Hide home and hamburger icons

When the top navigation bar is wide, the hamburger menu is hidden.

#+NAME: topnav-wide-hidden
#+BEGIN_SRC css
  #home { display: none; }
  #topnav label, #hamburger { display: none; }
#+END_SRC


** Narrow screens

These styles apply to screens narrower than 500px.

#+BEGIN_SRC css :noweb no-export
  @media all and (max-width: 500px) {
      <<narrow-topnav>>
      <<narrow-home>>
      <<narrow-hamburger>>
      <<narrow-topnav-links>>
      <<narrow-table-of-contents>>
      <<narrow-content>>
  }
#+END_SRC


*** Narrow top navigation bar

#+NAME: narrow-topnav
#+BEGIN_SRC css :tangle no
    #topnav {
        padding: 0.5em;
    }
#+END_SRC



*** Narrow home link

#+NAME: narrow-home
#+BEGIN_SRC css :tangle no
  #home {
      display: inline-block;
      background: var(--topnav-menu);
      color: white;
      text-decoration: none;
      border-radius: 0 8px 8px 0;
      padding: 0.5em;
  }
#+END_SRC


*** Narrow hamburger

#+NAME: narrow-hamburger
#+BEGIN_SRC css :tangle no
  #topnav label {
      display: inline-block;
      float: right;
      color: white;
      padding: 0.5em;
      margin: 0;
      background: var(--topnav-menu);
      border-radius: 8px;
      cursor: pointer;
  }
  #topnav label:hover {
      color: var(--topnav-menu);
      background: white;
  }
  #topnav ul { display: none; }
  #topnav input:checked ~ ul {
      display: block;
      width: 100%;
      margin: 0;
  }
#+END_SRC


*** TODO Narrow top navigation links

#+NAME: narrow-topnav-links
#+BEGIN_SRC css :tangle no
  #topnav ul {
      padding: 0;
  }
  #topnav ul a {
      box-sizing: border-box;
      display: block;
  }
#+END_SRC


*** Narrow table of contents

#+NAME: narrow-table-of-contents
#+BEGIN_SRC css :tangle no
  /* #table-of-contents { */
  /*       display: none; */
  /*   } */
#+END_SRC


*** Narrow content

#+NAME: narrow-content
#+BEGIN_SRC css :tangle no
  .outline-2 {
      width: 90%;
  }
#+END_SRC
Copyright 2019--2026 Marius PETER