This is the documentation repository for the One Day One Code journey, which tracks the progressive implementation and enhancement of coding skills through Code of The Day.
- Documentations Repository one-day-one-code: github.com/rizsvn/one-day-one-code
- Day Code Results
Day Code Result all day rizsvn.github.io/one-day-one-code/ 2025-01-01_05 rizsvn.github.io/one-day-one-code/2025-01-01_05/ 2025-01-05_31 Scheduled publication 2025-02-01_28 Awaiting publication 2025-03-01_31 Under development
CSS Navigation styling
.nav-container { background-image: linear-gradient(to bottom, #010409ff, #010409bf, #01040980, #01040900); position: sticky; top: 0; z-index: 9; height: 50px; display: flex; justify-content: space-around; align-items: center; width: 100%; padding-block: 1rem; margin-inline: auto; }- Applies a vertical gradient background for a visual effect.
- Sets position: sticky to keep the navbar at the top during scrolling.
- Uses a high z-index to ensure the navbar stays above other content.
- Defines a fixed height of 50px and uses flexbox for horizontal layout.
- Vertically centers items and evenly distributes them.
- Sets a 100% width and block padding of 1rem for internal spacing.
- Sets margin inline auto to center the element.
.nav-container a { line-height: 1rem; text-decoration: none; color: #c0c8ce; font-weight: lighter; transition: color 0.3s; }- Sets line-height for vertical text control.
- Removes text decoration and sets text color.
- Uses font-weight: lighter for a thinner text appearance.
- Adds color transition for a smooth hover effect.
.nav-logo { height: 32px; } .nav-logo .logo-nav { margin: 0; height: 100%; width: auto; object-fit: contain; font-size: 1em; font-weight: normal; color: #F0F6FC; line-height: 32px; }- Sets the logo container height to 32px.
- Removes logo margin, adjusts height to 100%, and width to auto.
- Uses object-fit: contain to ensure the logo is always visible.
- Sets logo font size and font weight.
- Sets logo color and line-height to match the container height.
.nav-menu ul { padding: 0; display: flex; justify-content: center; gap: 2rem; } .nav-menu li { list-style-type: none; }- Removes default padding on the ul list.
- Uses flexbox for horizontal layout of menu items.
- Sets spacing between menu items using gap.
- Removes list styles from li items.
.nav-container li a:hover { color: #F0F6FC; font-weight: normal; transition: color 0.3s ease-in-out; } .nav-container li a.active { color: #F0F6FC; font-weight: normal; transition: color 0.3s ease-in-out; } .nav-container li a.active::after { content: ""; display: block; width: 1em; height: 0.1em; background-color: #F0F6FC; margin: 0 auto; }- Changes color and font weight on hover or active states for visual indication.
- Adds color transition for smooth hover and active effects.
- Adds a short underline to the active link using the ::after pseudo-element.
- Sets the width, height, color, and margin of the underline.
- Uses display: block to allow dimension adjustments.
Extra:
- Added and edited some code on previous html:
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet"><h1>One Day One Code</h1>to<a href="#"><h1 class="logo-nav">one-day-one-code/</h1></a>
- Edited some styles on previous css:
font-family: 'Monserrat', sans-serif;tofont-family: "DM Mono", monospace;color: #F0F6FC;tocolor: #9198A1;
"Kickstart your Code of The Day with One Day One Code to progressively implement and enhance your coding skills." - Rizsan Zainal M
#onedayonecode #codeoftheday
CSS Initialization
<link rel="stylesheet" type="text/css" href="styles/style.css">Links external CSS file "style.css" for page styling.-
<link rel="preconnect" href="https://fonts.googleapis.com">Establishes early connection to Google Fonts server for faster font loading.<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>Preconnects to Google Fonts static content server, enabling cross-origin requests.<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">Imports Montserrat font family from Google Fonts with specified weights and styles.
*, *::before, *::after { box-sizing: border-box; }Sets all elements to use border-box model, including pseudo-elements, for consistent sizing.body { ... }Applies base styles to the body element.font-family: 'Monserrat', sans-serif;Sets the default font to Montserrat, with sans-serif fallback.margin: 0;padding: 0;Resets default margin and padding for consistent layout.background-color: #0D1117;Sets the background color to a dark shade.color: #F0F6FC;Sets the default text color to a light shade.display: flex;flex-direction: column;Uses flexbox to arrange body content in a column.
HTML Navigation on Header
<header class="nav-container">Defines the header section with a navigation container class.<div class="nav-logo">Defines the div section with a navigation logo container class.<h1>One Day One Code</h1>The main heading, displaying the site's title prominently.<nav class="nav-menu">A navigation menu container, used for grouping navigation links.<ul>An unordered list, the common structure for navigation menus.<li>A list item, representing a single navigation link.<a href="#">An anchor tag, creating a clickable link, with "#" as a placeholder URL.
HTML Metadata
<meta charset="utf-8">Character Encoding Declaration: Specifies UTF-8 character encoding, ensuring proper display of various characters.<meta name="description" content="Code of The Day - 2025-01-02 | One Day One Code">Page Description Metadata: Provides a brief description of the page content, used by search engines for snippets.<meta name="keywords" content="code of the day, one day one code">Keyword Metadata: Lists keywords related to the page content, aiding in search engine indexing.<meta name="author" content="Rizsan Zainal M">Author Metadata: Identifies the author of the page, useful for documentation and attribution.<meta name="viewport" content="width=device-width, initial-scale=1">Viewport Configuration: Sets the viewport for responsive design, ensuring proper rendering on various devices.
HTML First
<!DOCTYPE html>Document type declaration, essential for browser rendering.<html>Root element, encloses all other elements.<head>Contains document metadata, not displayed on the page.<title>Defines the page title, shown in the browser title or tab.<body>Main content container, visible page elements inside here.<h1>Primary heading, shows the main title of the page.<p>Paragraph element, used for standard text content.
© 2025 Rizsan Zainal M