Skip to content

Commit bb7f406

Browse files
committed
feat: added sticky header.
1 parent 4ba984e commit bb7f406

5 files changed

Lines changed: 140 additions & 103 deletions

File tree

index.html

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<!-- Window title. -->
8-
<title>Antigravity</title>
8+
<title>PyScript Exercises</title>
99
<!-- Window logo. -->
1010
<link rel="icon" type="image/png" href="rsrcs/media/icon-favicon.png" />
1111
<!--
@@ -14,8 +14,8 @@
1414
-->
1515
<link rel="stylesheet" href="https://pyscript.net/releases/2025.8.1/core.css" />
1616
<!-- External (local) CSS stylesheet, with multiple external CSS links. ORDER MATTERS! 'https://www.programminghead.com/how-to-link-multiple-css-style-sheets-in-html'. -->
17-
<link rel="stylesheet" href="rsrcs/io_inputs/app/config/web_pages/_style-loading_splashscreen.css">
18-
<link rel="stylesheet" href="rsrcs/io_inputs/app/config/web_pages/index-style.css">
17+
<link rel="stylesheet" href="rsrcs/io_inputs/app/config/web_pages/index-loading_splashscreen_(style).css">
18+
<link rel="stylesheet" href="rsrcs/io_inputs/app/config/web_pages/index_(style).css">
1919
<!--
2020
Script call; e.g. this js script tag bootstraps PyScript.
2121
- NOTE: threated as deferred script. Ref. 'https://stackoverflow.com/questions/436411/where-should-i-put-script-tags-in-html-markup/24070373#24070373'.
@@ -29,22 +29,33 @@
2929
- 'module' scripts: 'https://neerajdana.medium.com/understanding-type-module-in-javascript-a-comprehensive-guide-ebb13926da7a'.
3030
- 'module' vs. 'non-module' scripts: 'https://neerajdana.medium.com/understanding-type-module-in-javascript-a-comprehensive-guide-ebb13926da7a'.
3131
-->
32-
<script type="module" src="rsrcs/io_inputs/app/config/web_pages/_app-loading_splashscreen.js"></script>
32+
<script type="module" src="rsrcs/io_inputs/app/config/web_pages/index-loading_splashscreen_(app).js"></script>
3333
</head>
3434
<body>
35-
<!-- Main dialog (as 'modal', defined in js module 'app-loading_splashscreen.js'), what appears 1st as sson as web page is loaded. -->
35+
<!-- Main dialog (as 'modal', defined in js module '_app-loading_splashscreen.js'), what appears 1st as soon as web page is loaded. -->
3636
<dialog id="dialog_loading">
3737
<h1>Loading...</h1>
3838
</dialog>
39-
<main>
40-
<nav class="main-nav">
41-
<div class="main-nav-header">
39+
<header class="header">
40+
<nav class="header-nav">
41+
<div class="header-nav-left_aligned">
42+
<img class="header-nav-left_aligned-logo" src="rsrcs/media/img-logo.png" />
43+
<div class="header-nav-left_aligned-links_container">
44+
<a class="header-nav-left_aligned-links_container-link" href="index.html"><b>HOME</b></a>
45+
<!-- <a class="header-nav-left_aligned-links_container-link" href="rsrcs/io_inputs/app/config/web_pages/hello_world.html">Hello World</a>
46+
<a class="header-nav-left_aligned-links_container-link" href="rsrcs/io_inputs/app/config/web_pages/antigravity.html">Antigravity</a> -->
47+
</div>
48+
</div>
49+
<div class="header-nav-links_container">
4250
<!-- '/' in 'href' redirects to ROOT vs. '#' that redirects to TOP of CURRENT PAGE (causing scrolling): 'https://stackoverflow.com/questions/17772692/what-does-it-means-when-there-is-fowards-slash-after-a-href/17772747#17772747', 'https://www.w3schools.com/tags/att_a_href.asp'. -->
43-
<a href="/"><img class="main-nav-header-logo" src="rsrcs/media/img-logo.png" /></a>
51+
<a class="header-nav-links_container-link" href="/">[GOTO ROOT]</a>
4452
<!-- Blank 'href' REFRESH CURRENT PAGE; i.e. act as hyperlink to CURRENT PAGE: 'https://stackoverflow.com/questions/4855168/what-is-href-and-why-is-it-used/21397285#21397285'. -->
45-
<a class="main-nav-header-title" href="">Antigravity</a>
53+
<a class="header-nav-links_container-link" href="">[Refresh Current Page]</a>
54+
<a class="header-nav-links_container-link" href="#">[GOTO TOP]</a>
4655
</div>
4756
</nav>
57+
</header>
58+
<main>
4859
<section class="main-pyscript">
4960
<h1>Hello world!</h1>
5061
<br>

rsrcs/io_inputs/app/config/web_pages/_app-loading_splashscreen.js renamed to rsrcs/io_inputs/app/config/web_pages/index-loading_splashscreen_(app).js

File renamed without changes.

rsrcs/io_inputs/app/config/web_pages/_style-loading_splashscreen.css renamed to rsrcs/io_inputs/app/config/web_pages/index-loading_splashscreen_(style).css

File renamed without changes.

rsrcs/io_inputs/app/config/web_pages/index-style.css

Lines changed: 0 additions & 93 deletions
This file was deleted.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
/* IMPORTS. */
2+
3+
/*
4+
IMPORTS - FONTS.
5+
*/
6+
7+
/*
8+
Google Fonts:
9+
- 'Krona One':
10+
- URL: 'https://fonts.google.com/specimen/Krona+One'.
11+
- Specs: Weight: regular 400.
12+
- 'Montserrat':
13+
- URL: 'https://fonts.google.com/specimen/Montserrat'.
14+
- Specs: Weight: regular 400. Italic: Roman-only (no italic included).
15+
*/
16+
@import url('https://fonts.googleapis.com/css2?family=Krona+One&family=Montserrat&display=swap');
17+
18+
/*
19+
VARIABLES DECLARATION.
20+
- variable's name MUST BEGIN with 2 dashes (--), and it's CASE SENSITIVE.
21+
- Scopes:
22+
- Global scope: declare within ':root' selector.
23+
- Local scope: declare variable within specific selector, not in ':root'.
24+
- Ref.: 'https://www.w3schools.com/css/css3_variables.asp'.
25+
*/
26+
:root {
27+
--font_size_default: 16px; /* Default web-browsers font-size: 'https://stackoverflow.com/questions/29511983/is-the-default-font-size-of-every-browser-16px-why/29512572#29512572'. */
28+
--colors_background: #0D1117;
29+
--colors_01: #F0AB3C;
30+
--colors_02: #F6F6F6;
31+
--colors_03: #000000;
32+
--fonts_fallback: system-ui, sans-serif; /* Hierarchical list of fonts; from preferred, to fallback: 'https://www.w3schools.com/cssref/pr_font_font-family.php', 'https://developer.mozilla.org/en-US/docs/Web/CSS/font-family', 'https://www.w3schools.com/css/css_font_websafe.asp'. */
33+
--line_height_default: 1.5;
34+
--fonts_main: "Montserrat", var(--fonts_fallback);
35+
--fonts_minor: "Krona One", var(--fonts_fallback);
36+
}
37+
38+
/* Universal changes for all tags / elements / classes */
39+
* {
40+
/* Set proper dimensions for full page size: 'https://www.freecodecamp.org/news/html-page-width-height/'. */
41+
padding: 0;
42+
margin: 0;
43+
box-sizing: border-box; /* Set appropiate box-sizing: 'https://www.w3schools.com/css/css3_box-sizing.asp'. */
44+
}
45+
46+
/* DEFAULT HTML TAGS. */
47+
48+
html {
49+
font-size: var(--font_size_default); /* Recommended, explicit declaration: 'https://stackoverflow.com/questions/29511983/is-the-default-font-size-of-every-browser-16px-why/29512572#29512572'. */
50+
font-family: var(--fonts_main);
51+
line-height: var(--line_height_default);
52+
}
53+
54+
body {
55+
background-color: var(--colors_background);
56+
color: var(--colors_02);
57+
}
58+
59+
ul {
60+
padding: 10px 0px 0px 20px !important; /* IMPORTANT: lists REQUIRE PADDING; therefore, need manual adjustment, if padding set GLOBALLY to 0; i.e. '* { padding: 0; }'. Ref.: 'https://stackoverflow.com/questions/72279264/unordered-list-not-showing-bullets/72281511#72281511', 'https://www.w3schools.com/css/css_important.asp'.*/
61+
}
62+
63+
/* Use of 'media queries' to define layouts according to specific screen resolutions: 'https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_media_queries/Using_media_queries#targeting_media_features'. */
64+
@media (width > 0px) { /* Base design, as starting point: e.g. for desktop, although recommended to start with mobile, 1st: 'https://stackoverflow.com/questions/6370690/media-queries-how-to-target-desktop-tablet-and-mobile/20350990#20350990'. */
65+
66+
/* CUSTOM CLASSES. */
67+
68+
.header {
69+
/* Create a sticky header: 'https://www.w3schools.com/howto/howto_js_sticky_header.asp'. */
70+
position: sticky;
71+
top: 0;
72+
73+
background-color: var(--colors_03);
74+
padding: 10px; /* Padding: [top], [right], [bottom], [left]. Ref.: 'https://www.w3schools.com/css/css_padding.asp' */
75+
}
76+
77+
.header-nav {
78+
display: flex; /* Display as flexbox: 'https://css-tricks.com/snippets/css/a-guide-to-flexbox/#aa-display'. */
79+
gap: 15px; /* Separates flexbox items: logo-pages block, from navigation tools. Ref.: 'https://css-tricks.com/snippets/css/a-guide-to-flexbox/#aa-gap-row-gap-column-gap'.*/
80+
justify-content: space-between; /* Sends left (and right; only 2) flex-items to opposites. Ref.: 'https://css-tricks.com/snippets/css/a-guide-to-flexbox/#aa-justify-content'.*/
81+
align-items: center; /* Aligns vertically, to center the logo-pages block, with navigation tools. */
82+
}
83+
84+
.header-nav-left_aligned {
85+
display: flex;
86+
gap: 15px; /* Separates pages block from logo. */
87+
}
88+
89+
.header-nav-left_aligned-logo {
90+
height: 30px; /* Set proper height for logo. */
91+
}
92+
93+
.header-nav-left_aligned-links_container {
94+
display: flex;
95+
gap: 25px; /* Separate each page. */
96+
align-items: center; /* Matches vertical allignment of previous allignment of logo-pages block, with navigation tools. */
97+
}
98+
99+
.header-nav-left_aligned-links_container-link {
100+
color: var(--colors_01);
101+
text-decoration-line: none; /* To eliminate underscore format of hyperlinks. */
102+
font-size: 1.3em;
103+
}
104+
105+
.header-nav-links_container {
106+
display: flex;
107+
flex-direction: column;
108+
font-size: 0.8em;
109+
}
110+
111+
.header-nav-links_container-link {
112+
text-decoration-line: none;
113+
}
114+
115+
.main-pyscript {
116+
margin: 0.5rem;
117+
}
118+
119+
}

0 commit comments

Comments
 (0)