Heim >Web-Frontend >js-Tutorial >Ich habe die ULTIMATIVE Bildungswebsite von Grund auf erstellt – Tag 2

Ich habe die ULTIMATIVE Bildungswebsite von Grund auf erstellt – Tag 2

Barbara Streisand
Barbara StreisandOriginal
2025-01-10 11:13:43818Durchsuche

I Built the ULTIMATE Educational Website from Scratch — Day 2

Gestern haben wir an index.html gearbeitet, und heute arbeiten wir an subject.html und about.html. Wir werden sehen, ob wir noch genügend Zeit haben, um an unseren Themenseiten wie Chemie, Mathematik usw. zu arbeiten.

Stunde 14: Erstellen der Themenseite

Ich beginne mit subject.html. Wie zuvor verwende ich mein benutzerdefiniertes Boilerplate, das ich gestern für dieses Projekt entworfen habe:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neuron IQ - Subjects</title>
     <link rel="stylesheet" href="style.css">
     <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet">
</head>
<body>
    <header>
        <nav>
            <div>



<p>I've added the basic structure, linked the stylesheet and added navigation that takes us to the other pages. The goal is to keep consistency between pages.</p>

<p>Now, let's add the content for the page. I want a hero section similar to the one on the index page but with a focus on subjects:<br>
</p>

<pre class="brush:php;toolbar:false">    <section>



<p>This will serve as a good header for the page, and it looks consistent with the index page hero section.</p>

<p>Next up is the main content area: a grid of subjects, like the categories section on the home page:<br>
</p>

<pre class="brush:php;toolbar:false">  <section>



<p>This grid will display all the subjects, making it easy for the user to explore, and it also is consistent with the home page layout.</p>

<p>I'll keep the footer consistent with the rest of the site, and use the same code from index.html.</p>

<h2>
  
  
  Hour 15: Building the About Page
</h2>

<p>Now, let's move on to about.html. I'll start with the same HTML boilerplate as usual:<br>
</p>

<pre class="brush:php;toolbar:false"><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neuron IQ - About Us</title>
     <link rel="stylesheet" href="style.css">
       <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet">
</head>
<body>
    <header>
         <nav>
            <div>



<p>I've included a header and footer identical to the other pages. This keeps the navigation consistent.</p>

<p>For the about page, I start with a hero section, just like on the home and subject page:<br>
</p>

<pre class="brush:php;toolbar:false">    <section>



<p>The hero section includes a heading and a short paragraph to introduce the page.</p>

<p>Now, I'll add the main content section, divided into two sections: mission and values.<br>
</p>

<pre class="brush:php;toolbar:false">  <section>



<p>This is very standard design, with some bold elements to improve the user experience, which I liked very much.</p>

<p>I initially planned to include a team section, but I decided against it for now. I may add it later when I have more info.<br>
</p>

<pre class="brush:php;toolbar:false">  <!-- <div>



<p>And that completes both subjects.html and about.html for now, and the main-pages are done! For those wondering, this is how our pages looks like at the end of the day.<br>
Subjects Page<br>
About Page</p>

<p>Okay, let's get started with the subject-specific pages.</p>
<h2>
  
  
  Hour 16: Setting up the Chemistry Subject Page
</h2>

<p>First, I created a folder, \Chemistry. Then, inside this folder, I created an index.html file.<br>
</p>

<pre class="brush:php;toolbar:false"><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neuron IQ - Chemistry</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="style-main.css">
       <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet">
</head>
<body>
    <header>
        <nav>
            <div>



<p>This page, like the others, starts with my basic HTML structure, with navigation links to our main pages (/index.html, /subjects.html, and /about.html) and also a link to the main style sheets.</p>

<p>Now, let's add the structure for this page:<br>
</p>

<pre class="brush:php;toolbar:false">  <section>



<p>This sets up a three-column layout with an article list on the left, main topics in the center, and another topic list on the right. This is all within the .chemistry-page section. Before moving on, let's address few questions you may have;</p>

  • Some href values are "1.html", "organic.html", and some are just "#". Answer: I used "1.html", "organic.html", etc., for links that are ready. The "#" is a placeholder for pages not yet developed. It keeps the structure consistent and visually complete, allowing me to see how the final site will look, while indicating that the content isn't available yet.

Finally, I'll keep the same footer as all of the other pages, to keep consistency.

Hour 17: Styling the Chemistry Page

Now, I need to style this Chemistry page. I started by creating a new file inside the Chemistry folder, style.css.

I wanted a design that was distinct and visually appealing. Here’s what I came up with:

:root {
    --primary-color: #00bcd4; /* Vibrant yet professional */
    --secondary-color: #ffc107; /* Energetic accent */
    --background-dark: #1a1a1a; /* Deeper, richer dark */
    --background-light: #2e2e2e; /* Slightly lighter for contrast */
    --text-light: #f0f0f0; /* Softer off-white */
    --text-accent: #ffffff; /* Pure white for emphasis */
    --border-radius: 12px; /* More pronounced curves */
    --shadow-light: rgba(0, 0, 0, 0.15); /* Subtle shadow */
    --transition-duration: 0.3s;
    --font-family-base: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-family-heading: 'Montserrat', sans-serif;
}

body {
    font-family: var(--font-family-base);
    background-color: var(--background-dark);
    color: var(--text-light);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased; /* Smoother fonts for webkit browsers */
    -moz-osx-font-smoothing: grayscale; /* Smoother fonts for Firefox */
}

.chemistry-page {
    display: flex;
    max-width: 1200px;
    margin: 60px auto; /* Increased top/bottom margin */
    padding: 30px; /* Increased padding for spaciousness */
    background: linear-gradient(145deg, var(--background-dark), #111111); /* Subtle gradient */
    border-radius: var(--border-radius);
    box-shadow: 0 8px 16px var(--shadow-light); /* More pronounced shadow */
}

.article-list, .topic-list {
    flex: 1;
    padding: 30px; /* Increased padding */
    background: var(--background-light);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px var(--shadow-light);
    margin: 0 15px; /* Increased horizontal margin */
    transition: transform var(--transition-duration), box-shadow var(--transition-duration); /* Smooth transitions */
}

.article-list:hover, .topic-list:hover {
    transform: translateY(-5px); /* Gentle lift on hover */
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.article-list h2, .topic-list h2 {
    margin-bottom: 25px; /* Increased bottom margin */
    text-align: center;
    font-family: var(--font-family-heading);
    font-size: 1.8rem; /* Slightly larger */
    color: var(--text-accent);
    position: relative; /* For pseudo-element underline */
    padding-bottom: 10px;
}

.article-list h2::after, .topic-list h2::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
    transform: translateX(-50%);
}

.article-list ul, .topic-list ul {
    list-style: none;
    padding: 0;
}

.article-list ul li, .topic-list ul li {
    margin-bottom: 15px; /* Increased bottom margin */
    border-bottom: 1px solid #444; /* Subtle divider */
    padding-bottom: 10px;
}
.article-list ul li:last-child, .topic-list ul li:last-child {
    border-bottom: none; /* Remove border from the last item */
    padding-bottom: 0;
    margin-bottom: 0;
}

.article-list ul li a, .topic-list ul li a {
    display: block;
    padding: 15px; /* Increased padding */
    text-decoration: none;
    color: var(--text-light);
    background: linear-gradient(to bottom right, #333, #222); /* Subtle gradient */
    border-radius: calc(var(--border-radius) / 2); /* Smaller radius for list items */
    transition: background var(--transition-duration), transform var(--transition-duration);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); /* Add shadow to list items */
}

.article-list ul li a:hover, .topic-list ul li a:hover {
    background: linear-gradient(to bottom right, var(--primary-color), #0097a7); /* More vibrant hover */
    transform: scale(1.02); /* Gentle scale on hover */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    color: var(--text-accent);
}

.content-grid {
    flex: 3;
    padding: 30px; /* Increased padding */
    margin: 0 15px; /* Increased horizontal margin */
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* Slightly wider min-width */
    gap: 25px; /* Increased gap */
}

.topic-grid a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    background: var(--background-light);
    padding: 30px; /* Increased padding */
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px var(--shadow-light);
    transition: transform var(--transition-duration), box-shadow var(--transition-duration);
}

.topic-grid a img {
    width: 60px; /* Larger icon */
    height: 60px; /* Larger icon */
    margin-bottom: 15px; /* Increased bottom margin */
    filter: brightness(1.1); /* Slightly brighten the icons */
    transition: transform var(--transition-duration);
}

.topic-grid a:hover {
    transform: scale(1.05); /* Gentle scale on hover */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.topic-grid a:hover img {
    transform: scale(1.1); /* Scale the icon on hover */
}

/* Responsive adjustments with smoother transitions */
@media (max-width: 768px) {
    .chemistry-page {
        flex-direction: column;
        margin: 30px auto; /* Adjust margins for smaller screens */
        padding: 20px;
    }
    .article-list, .topic-list, .content-grid {
        margin: 15px 0;
        padding: 20px;
    }
    .topic-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Adjust for smaller screens */
    }
}

/* Further refinements for smaller screens */
@media (max-width: 576px) {
    .chemistry-page {
        padding: 15px;
    }
    .article-list, .topic-list, .content-grid {
        padding: 15px;
    }
    .article-list h2, .topic-list h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    .topic-grid {
        gap: 15px;
    }
    .topic-grid a {
        padding: 20px;
    }
    .topic-grid a img {
        width: 40px;
        height: 40px;
        margin-bottom: 10px;
    }
}

Ich habe ein lebendiges und modernes Design mit einem dunklen Thema und subtilen Farbverläufen hinzugefügt. Das Layout verwendet Flexbox und Raster für die Reaktionsfähigkeit. Ich habe auch einige nette Hover-Effekte eingefügt, um die Seite interaktiver zu gestalten.
Bevor wir fortfahren, wollen wir einige Fragen beantworten, die Sie möglicherweise haben;

  • Warum benutzerdefinierte Eigenschaften (Variablen) verwenden, anstatt die Farbwerte einfach direkt in die Regeln zu schreiben?
  • Wie wurde das Farbschema (lebendig und dennoch professionell) ausgewählt? Und warum passen diese Farben gut zusammen?

Antwort: Ich habe mich aus mehreren Gründen für die Verwendung benutzerdefinierter Eigenschaften (Variablen) entschieden. In erster Linie verbessern sie die Wartbarkeit und Konsistenz. Das Ändern einer Farbe im gesamten Stylesheet ist so einfach wie das Ändern des Variablenwerts im Stammverzeichnis. Dies ist weitaus effizienter, als jede Instanz eines bestimmten Farbcodes aufzuspüren. Darüber hinaus verbessern Variablen die Lesbarkeit, indem sie den Werten aussagekräftige Namen geben und so die Absicht des Codes klarer machen. Es erleichtert auch die Themengestaltung und ermöglicht dynamische Änderungen basierend auf Benutzerpräferenzen oder verschiedenen Modi.
Das Farbschema wurde mit dem Ziel ausgewählt, eine „lebendige und dennoch professionelle“ Ästhetik zu schaffen. Ich wollte ein Gleichgewicht zwischen energisch und vertrauenswürdig.

  • --primary-color: #00bcd4 (Vibrant Cyan): Dies ist eine helle, ansprechende Farbe, die ein Gefühl von Modernität und Innovation hervorruft und zu einem wissenschaftsbezogenen Thema passt. Es ist nicht übermäßig gesättigt und behält ein gewisses Maß an Professionalität bei.
  • --secondary-color: #ffc107 (Energetisches Gelb): Dieses Gelb fungiert als ergänzender Akzent und verleiht einen Hauch von Energie und Optimismus. Gelb wird oft mit Kreativität und Intellekt assoziiert.
  • Dunkle Hintergründe (--background-dark, --background-light): Der dunkle Hintergrund bietet eine starke, stabile Grundlage, die die helleren Farben hervorheben lässt. Es verleiht auch ein edles Gefühl.
  • Heller Text (--text-light, --text-accent): Cremeweißer und reinweißer Text auf dem dunklen Hintergrund sorgt für eine gute Lesbarkeit und ein klares, modernes Aussehen.

Warum sie gut zusammenarbeiten:

  1. Komplementärer Kontrast: Cyan und Gelb sind nahezu Komplementärfarben und erzeugen einen optisch ansprechenden Kontrast, der dynamisch, aber nicht störend ist.
  2. Analoge Harmonie: Die dunklen Hintergrundtöne sind analog, d. h. sie liegen im Farbkreis nahe beieinander, wodurch ein harmonisches und zusammenhängendes Gefühl entsteht.
  3. Wertekontrast:Der deutliche Wertunterschied (Helligkeit/Dunkelheit) zwischen Text und Hintergrund gewährleistet eine hervorragende Lesbarkeit.
  4. Ausgewogene Sättigung: Die Primär- und Sekundärfarben sind lebendig, aber nicht übermäßig gesättigt, wodurch ein kindlicher oder überwältigender Eindruck vermieden wird. Sie werden durch den eher gedämpften Hintergrund ausgeglichen.

Im Wesentlichen entsteht durch die Kombination einer hellen, modernen Grundfarbe, eines warmen Akzents und eines eleganten dunklen Hintergrunds zusammen mit sorgfältig ausgewählten Textfarben eine Palette, die sowohl optisch ansprechend als auch für einen professionellen, pädagogischen Kontext geeignet ist.

Diese Stile funktionieren jedoch nur für die Chemieseite und nicht für die gesamte Website. Also habe ich in Chemistry eine weitere CSS-Datei, style-main.css, erstellt, um die Hauptstile zu überschreiben.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neuron IQ - Subjects</title>
     <link rel="stylesheet" href="style.css">
     <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet">
</head>
<body>
    <header>
        <nav>
            <div>



<p>I've added the basic structure, linked the stylesheet and added navigation that takes us to the other pages. The goal is to keep consistency between pages.</p>

<p>Now, let's add the content for the page. I want a hero section similar to the one on the index page but with a focus on subjects:<br>
</p>

<pre class="brush:php;toolbar:false">    <section>



<p>This will serve as a good header for the page, and it looks consistent with the index page hero section.</p>

<p>Next up is the main content area: a grid of subjects, like the categories section on the home page:<br>
</p>

<pre class="brush:php;toolbar:false">  <section>



<p>This grid will display all the subjects, making it easy for the user to explore, and it also is consistent with the home page layout.</p>

<p>I'll keep the footer consistent with the rest of the site, and use the same code from index.html.</p>

<h2>
  
  
  Hour 15: Building the About Page
</h2>

<p>Now, let's move on to about.html. I'll start with the same HTML boilerplate as usual:<br>
</p>

<pre class="brush:php;toolbar:false"><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neuron IQ - About Us</title>
     <link rel="stylesheet" href="style.css">
       <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet">
</head>
<body>
    <header>
         <nav>
            <div>



<p>I've included a header and footer identical to the other pages. This keeps the navigation consistent.</p>

<p>For the about page, I start with a hero section, just like on the home and subject page:<br>
</p>

<pre class="brush:php;toolbar:false">    <section>



<p>The hero section includes a heading and a short paragraph to introduce the page.</p>

<p>Now, I'll add the main content section, divided into two sections: mission and values.<br>
</p>

<pre class="brush:php;toolbar:false">  <section>



<p>This is very standard design, with some bold elements to improve the user experience, which I liked very much.</p>

<p>I initially planned to include a team section, but I decided against it for now. I may add it later when I have more info.<br>
</p>

<pre class="brush:php;toolbar:false">  <!-- <div>



<p>And that completes both subjects.html and about.html for now, and the main-pages are done! For those wondering, this is how our pages looks like at the end of the day.<br>
Subjects Page<br>
About Page</p>

<p>Okay, let's get started with the subject-specific pages.</p>
<h2>
  
  
  Hour 16: Setting up the Chemistry Subject Page
</h2>

<p>First, I created a folder, \Chemistry. Then, inside this folder, I created an index.html file.<br>
</p>

<pre class="brush:php;toolbar:false"><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neuron IQ - Chemistry</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="style-main.css">
       <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet">
</head>
<body>
    <header>
        <nav>
            <div>



<p>This page, like the others, starts with my basic HTML structure, with navigation links to our main pages (/index.html, /subjects.html, and /about.html) and also a link to the main style sheets.</p>

<p>Now, let's add the structure for this page:<br>
</p>

<pre class="brush:php;toolbar:false">  <section>



<p>This sets up a three-column layout with an article list on the left, main topics in the center, and another topic list on the right. This is all within the .chemistry-page section. Before moving on, let's address few questions you may have;</p>

  • Some href values are "1.html", "organic.html", and some are just "#". Answer: I used "1.html", "organic.html", etc., for links that are ready. The "#" is a placeholder for pages not yet developed. It keeps the structure consistent and visually complete, allowing me to see how the final site will look, while indicating that the content isn't available yet.

Finally, I'll keep the same footer as all of the other pages, to keep consistency.

Hour 17: Styling the Chemistry Page

Now, I need to style this Chemistry page. I started by creating a new file inside the Chemistry folder, style.css.

I wanted a design that was distinct and visually appealing. Here’s what I came up with:

:root {
    --primary-color: #00bcd4; /* Vibrant yet professional */
    --secondary-color: #ffc107; /* Energetic accent */
    --background-dark: #1a1a1a; /* Deeper, richer dark */
    --background-light: #2e2e2e; /* Slightly lighter for contrast */
    --text-light: #f0f0f0; /* Softer off-white */
    --text-accent: #ffffff; /* Pure white for emphasis */
    --border-radius: 12px; /* More pronounced curves */
    --shadow-light: rgba(0, 0, 0, 0.15); /* Subtle shadow */
    --transition-duration: 0.3s;
    --font-family-base: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-family-heading: 'Montserrat', sans-serif;
}

body {
    font-family: var(--font-family-base);
    background-color: var(--background-dark);
    color: var(--text-light);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased; /* Smoother fonts for webkit browsers */
    -moz-osx-font-smoothing: grayscale; /* Smoother fonts for Firefox */
}

.chemistry-page {
    display: flex;
    max-width: 1200px;
    margin: 60px auto; /* Increased top/bottom margin */
    padding: 30px; /* Increased padding for spaciousness */
    background: linear-gradient(145deg, var(--background-dark), #111111); /* Subtle gradient */
    border-radius: var(--border-radius);
    box-shadow: 0 8px 16px var(--shadow-light); /* More pronounced shadow */
}

.article-list, .topic-list {
    flex: 1;
    padding: 30px; /* Increased padding */
    background: var(--background-light);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px var(--shadow-light);
    margin: 0 15px; /* Increased horizontal margin */
    transition: transform var(--transition-duration), box-shadow var(--transition-duration); /* Smooth transitions */
}

.article-list:hover, .topic-list:hover {
    transform: translateY(-5px); /* Gentle lift on hover */
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.article-list h2, .topic-list h2 {
    margin-bottom: 25px; /* Increased bottom margin */
    text-align: center;
    font-family: var(--font-family-heading);
    font-size: 1.8rem; /* Slightly larger */
    color: var(--text-accent);
    position: relative; /* For pseudo-element underline */
    padding-bottom: 10px;
}

.article-list h2::after, .topic-list h2::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
    transform: translateX(-50%);
}

.article-list ul, .topic-list ul {
    list-style: none;
    padding: 0;
}

.article-list ul li, .topic-list ul li {
    margin-bottom: 15px; /* Increased bottom margin */
    border-bottom: 1px solid #444; /* Subtle divider */
    padding-bottom: 10px;
}
.article-list ul li:last-child, .topic-list ul li:last-child {
    border-bottom: none; /* Remove border from the last item */
    padding-bottom: 0;
    margin-bottom: 0;
}

.article-list ul li a, .topic-list ul li a {
    display: block;
    padding: 15px; /* Increased padding */
    text-decoration: none;
    color: var(--text-light);
    background: linear-gradient(to bottom right, #333, #222); /* Subtle gradient */
    border-radius: calc(var(--border-radius) / 2); /* Smaller radius for list items */
    transition: background var(--transition-duration), transform var(--transition-duration);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); /* Add shadow to list items */
}

.article-list ul li a:hover, .topic-list ul li a:hover {
    background: linear-gradient(to bottom right, var(--primary-color), #0097a7); /* More vibrant hover */
    transform: scale(1.02); /* Gentle scale on hover */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    color: var(--text-accent);
}

.content-grid {
    flex: 3;
    padding: 30px; /* Increased padding */
    margin: 0 15px; /* Increased horizontal margin */
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* Slightly wider min-width */
    gap: 25px; /* Increased gap */
}

.topic-grid a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    background: var(--background-light);
    padding: 30px; /* Increased padding */
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px var(--shadow-light);
    transition: transform var(--transition-duration), box-shadow var(--transition-duration);
}

.topic-grid a img {
    width: 60px; /* Larger icon */
    height: 60px; /* Larger icon */
    margin-bottom: 15px; /* Increased bottom margin */
    filter: brightness(1.1); /* Slightly brighten the icons */
    transition: transform var(--transition-duration);
}

.topic-grid a:hover {
    transform: scale(1.05); /* Gentle scale on hover */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.topic-grid a:hover img {
    transform: scale(1.1); /* Scale the icon on hover */
}

/* Responsive adjustments with smoother transitions */
@media (max-width: 768px) {
    .chemistry-page {
        flex-direction: column;
        margin: 30px auto; /* Adjust margins for smaller screens */
        padding: 20px;
    }
    .article-list, .topic-list, .content-grid {
        margin: 15px 0;
        padding: 20px;
    }
    .topic-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Adjust for smaller screens */
    }
}

/* Further refinements for smaller screens */
@media (max-width: 576px) {
    .chemistry-page {
        padding: 15px;
    }
    .article-list, .topic-list, .content-grid {
        padding: 15px;
    }
    .article-list h2, .topic-list h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    .topic-grid {
        gap: 15px;
    }
    .topic-grid a {
        padding: 20px;
    }
    .topic-grid a img {
        width: 40px;
        height: 40px;
        margin-bottom: 10px;
    }
}

Diese Datei „style-main.css“ überschreibt den Stil in der Hauptdatei „style.css“ und gilt für alle Seiten. Lassen Sie uns nun über die Notwendigkeit von style-main.css sprechen. Erfahrene Entwickler haben es vielleicht verstanden, aber für die nicht so erfahrenen Entwickler da draußen;

  • Das Problem: Während style.css (im Stammverzeichnis) die Grundlage bildet und das chemiespezifische style.css einzigartige Elemente verarbeitet, müssen einige davon modifiziert werden die globalen Stile speziell für den Bereich Chemie. Eine direkte Änderung der Root style.css hätte Auswirkungen auf die gesamte Website, was unerwünscht ist.
  • Die Lösung: style-main.css wird eingeführt, um bestimmte globale Stile aus der Wurzel style.css nur auf der Chemieseite zu überschreiben. Es ermöglicht auch das Hinzufügen neuer Stile, die allgemeiner sind als die in der chemiespezifischen style.css, aber dennoch nicht auf die gesamte Website anwendbar sind.
  • Beispiel:
    • Die Root style.css definiert möglicherweise eine Standard-Schaltflächenfarbe.
    • Auf der Seite „Chemie“ möchten Sie möglicherweise eine andere Schaltflächenfarbe oder passen Sie die Polsterung an.
    • style-main.css würde die CSS-Regeln enthalten, um die Farbe und Polsterung der Schaltfläche zu überschreiben, aber nur für den Abschnitt „Chemie“.
  • Vorteile:
    • Modularität: Hält Stiländerungen organisiert und im relevanten Betreffordner enthalten.
    • Wartbarkeit: Stile für einen bestimmten Abschnitt lassen sich einfacher aktualisieren oder ändern, ohne dass sich dies auf andere auswirkt.
    • Besonderheit: Überschreibungen sind zielgerichtet und erfordern keine komplexen CSS-Selektoren, um den gewünschten Effekt zu erzielen.
    • Vermeidet Codeduplizierung: Allgemeine Überschreibungen oder Ergänzungen für einen Themenbereich können in style-main.css platziert werden, anstatt in mehreren themenspezifischen Stylesheets wiederholt zu werden.

Stunde 18: Seitengestaltung für spezifische Chemie

Um zu vermeiden, dass die Stile zu komplex werden, habe ich mich entschieden, eine andere Stylesheet-Datei, Specific-chemistry.css, im Ordner „Chemistry“ zu verwenden. Dadurch wird die Betreffseite formatiert und die anderen Dateien bleiben übersichtlich.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neuron IQ - Subjects</title>
     <link rel="stylesheet" href="style.css">
     <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet">
</head>
<body>
    <header>
        <nav>
            <div>



<p>I've added the basic structure, linked the stylesheet and added navigation that takes us to the other pages. The goal is to keep consistency between pages.</p>

<p>Now, let's add the content for the page. I want a hero section similar to the one on the index page but with a focus on subjects:<br>
</p>

<pre class="brush:php;toolbar:false">    <section>



<p>This will serve as a good header for the page, and it looks consistent with the index page hero section.</p>

<p>Next up is the main content area: a grid of subjects, like the categories section on the home page:<br>
</p>

<pre class="brush:php;toolbar:false">  <section>



<p>This grid will display all the subjects, making it easy for the user to explore, and it also is consistent with the home page layout.</p>

<p>I'll keep the footer consistent with the rest of the site, and use the same code from index.html.</p>

<h2>
  
  
  Hour 15: Building the About Page
</h2>

<p>Now, let's move on to about.html. I'll start with the same HTML boilerplate as usual:<br>
</p>

<pre class="brush:php;toolbar:false"><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neuron IQ - About Us</title>
     <link rel="stylesheet" href="style.css">
       <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet">
</head>
<body>
    <header>
         <nav>
            <div>



<p>I've included a header and footer identical to the other pages. This keeps the navigation consistent.</p>

<p>For the about page, I start with a hero section, just like on the home and subject page:<br>
</p>

<pre class="brush:php;toolbar:false">    <section>



<p>The hero section includes a heading and a short paragraph to introduce the page.</p>

<p>Now, I'll add the main content section, divided into two sections: mission and values.<br>
</p>

<pre class="brush:php;toolbar:false">  <section>



<p>This is very standard design, with some bold elements to improve the user experience, which I liked very much.</p>

<p>I initially planned to include a team section, but I decided against it for now. I may add it later when I have more info.<br>
</p>

<pre class="brush:php;toolbar:false">  <!-- <div>



<p>And that completes both subjects.html and about.html for now, and the main-pages are done! For those wondering, this is how our pages looks like at the end of the day.<br>
Subjects Page<br>
About Page</p>

<p>Okay, let's get started with the subject-specific pages.</p>
<h2>
  
  
  Hour 16: Setting up the Chemistry Subject Page
</h2>

<p>First, I created a folder, \Chemistry. Then, inside this folder, I created an index.html file.<br>
</p>

<pre class="brush:php;toolbar:false"><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neuron IQ - Chemistry</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="style-main.css">
       <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet">
</head>
<body>
    <header>
        <nav>
            <div>



<p>This page, like the others, starts with my basic HTML structure, with navigation links to our main pages (/index.html, /subjects.html, and /about.html) and also a link to the main style sheets.</p>

<p>Now, let's add the structure for this page:<br>
</p>

<pre class="brush:php;toolbar:false">  <section>



<p>This sets up a three-column layout with an article list on the left, main topics in the center, and another topic list on the right. This is all within the .chemistry-page section. Before moving on, let's address few questions you may have;</p>

  • Some href values are "1.html", "organic.html", and some are just "#". Answer: I used "1.html", "organic.html", etc., for links that are ready. The "#" is a placeholder for pages not yet developed. It keeps the structure consistent and visually complete, allowing me to see how the final site will look, while indicating that the content isn't available yet.

Finally, I'll keep the same footer as all of the other pages, to keep consistency.

Hour 17: Styling the Chemistry Page

Now, I need to style this Chemistry page. I started by creating a new file inside the Chemistry folder, style.css.

I wanted a design that was distinct and visually appealing. Here’s what I came up with:

:root {
    --primary-color: #00bcd4; /* Vibrant yet professional */
    --secondary-color: #ffc107; /* Energetic accent */
    --background-dark: #1a1a1a; /* Deeper, richer dark */
    --background-light: #2e2e2e; /* Slightly lighter for contrast */
    --text-light: #f0f0f0; /* Softer off-white */
    --text-accent: #ffffff; /* Pure white for emphasis */
    --border-radius: 12px; /* More pronounced curves */
    --shadow-light: rgba(0, 0, 0, 0.15); /* Subtle shadow */
    --transition-duration: 0.3s;
    --font-family-base: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-family-heading: 'Montserrat', sans-serif;
}

body {
    font-family: var(--font-family-base);
    background-color: var(--background-dark);
    color: var(--text-light);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased; /* Smoother fonts for webkit browsers */
    -moz-osx-font-smoothing: grayscale; /* Smoother fonts for Firefox */
}

.chemistry-page {
    display: flex;
    max-width: 1200px;
    margin: 60px auto; /* Increased top/bottom margin */
    padding: 30px; /* Increased padding for spaciousness */
    background: linear-gradient(145deg, var(--background-dark), #111111); /* Subtle gradient */
    border-radius: var(--border-radius);
    box-shadow: 0 8px 16px var(--shadow-light); /* More pronounced shadow */
}

.article-list, .topic-list {
    flex: 1;
    padding: 30px; /* Increased padding */
    background: var(--background-light);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px var(--shadow-light);
    margin: 0 15px; /* Increased horizontal margin */
    transition: transform var(--transition-duration), box-shadow var(--transition-duration); /* Smooth transitions */
}

.article-list:hover, .topic-list:hover {
    transform: translateY(-5px); /* Gentle lift on hover */
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.article-list h2, .topic-list h2 {
    margin-bottom: 25px; /* Increased bottom margin */
    text-align: center;
    font-family: var(--font-family-heading);
    font-size: 1.8rem; /* Slightly larger */
    color: var(--text-accent);
    position: relative; /* For pseudo-element underline */
    padding-bottom: 10px;
}

.article-list h2::after, .topic-list h2::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
    transform: translateX(-50%);
}

.article-list ul, .topic-list ul {
    list-style: none;
    padding: 0;
}

.article-list ul li, .topic-list ul li {
    margin-bottom: 15px; /* Increased bottom margin */
    border-bottom: 1px solid #444; /* Subtle divider */
    padding-bottom: 10px;
}
.article-list ul li:last-child, .topic-list ul li:last-child {
    border-bottom: none; /* Remove border from the last item */
    padding-bottom: 0;
    margin-bottom: 0;
}

.article-list ul li a, .topic-list ul li a {
    display: block;
    padding: 15px; /* Increased padding */
    text-decoration: none;
    color: var(--text-light);
    background: linear-gradient(to bottom right, #333, #222); /* Subtle gradient */
    border-radius: calc(var(--border-radius) / 2); /* Smaller radius for list items */
    transition: background var(--transition-duration), transform var(--transition-duration);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); /* Add shadow to list items */
}

.article-list ul li a:hover, .topic-list ul li a:hover {
    background: linear-gradient(to bottom right, var(--primary-color), #0097a7); /* More vibrant hover */
    transform: scale(1.02); /* Gentle scale on hover */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    color: var(--text-accent);
}

.content-grid {
    flex: 3;
    padding: 30px; /* Increased padding */
    margin: 0 15px; /* Increased horizontal margin */
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* Slightly wider min-width */
    gap: 25px; /* Increased gap */
}

.topic-grid a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    background: var(--background-light);
    padding: 30px; /* Increased padding */
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px var(--shadow-light);
    transition: transform var(--transition-duration), box-shadow var(--transition-duration);
}

.topic-grid a img {
    width: 60px; /* Larger icon */
    height: 60px; /* Larger icon */
    margin-bottom: 15px; /* Increased bottom margin */
    filter: brightness(1.1); /* Slightly brighten the icons */
    transition: transform var(--transition-duration);
}

.topic-grid a:hover {
    transform: scale(1.05); /* Gentle scale on hover */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.topic-grid a:hover img {
    transform: scale(1.1); /* Scale the icon on hover */
}

/* Responsive adjustments with smoother transitions */
@media (max-width: 768px) {
    .chemistry-page {
        flex-direction: column;
        margin: 30px auto; /* Adjust margins for smaller screens */
        padding: 20px;
    }
    .article-list, .topic-list, .content-grid {
        margin: 15px 0;
        padding: 20px;
    }
    .topic-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Adjust for smaller screens */
    }
}

/* Further refinements for smaller screens */
@media (max-width: 576px) {
    .chemistry-page {
        padding: 15px;
    }
    .article-list, .topic-list, .content-grid {
        padding: 15px;
    }
    .article-list h2, .topic-list h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    .topic-grid {
        gap: 15px;
    }
    .topic-grid a {
        padding: 20px;
    }
    .topic-grid a img {
        width: 40px;
        height: 40px;
        margin-bottom: 10px;
    }
}

Dies verleiht dem dreispaltigen Layout, das ich in der index.html im Ordner „Chemistry“ verwendet habe, Stil. Dadurch sieht die Seite viel sauberer und professioneller aus. Ich habe auch ein responsives Design für kleine Bildschirme hinzugefügt.
Für diejenigen, die die Live-Vorschau wünschen:
Chemie

Da es sich um eine einfache Seite handelte, hatte ich nicht das Bedürfnis, eine script.js hinzuzufügen
Das ist alles für heute. Vielleicht sehe ich dich morgen. Bis dahin, wir sehen uns

Das obige ist der detaillierte Inhalt vonIch habe die ULTIMATIVE Bildungswebsite von Grund auf erstellt – Tag 2. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn