Logo creator project: custom styles and responsiveness

Lesson 15 of 17 · HTML, CSS and JavaScript

Bootstrap gave us the layout, but the site still looks like every other one. In this lesson we write css/main.css: the site colors in one place, a background image with a color overlay, effects when the mouse is over an element, and a check on a phone. This is the part that makes your site different from the others.

Before you start: prerequisites – the project home page, the box model and backgrounds (SR).
How to learn: do the tasks at the end on your own in your editor first; open the hints and the solution only after that. Every example has code and a live result below it; type the code into your own file and change it.

1. Colors in one place: CSS variables

/* ===== css/main.css – Logo Kreator ===== */

/* 1. site colors in one place (CSS variables) */
:root {
  --lk-crvena: #dd0022;
  --lk-tamna: #1f2a44;
  --lk-svetla: #fff5f6;
}

body { font-family: "Segoe UI", system-ui, Arial, sans-serif; }

A variable is defined in :root (the whole document) with two dashes, and used as var(--lk-crvena). If you later want a blue site, you change one line instead of twenty. The lk- prefix (Logo Kreator) prevents clashes with Bootstrap's variables (--bs-...).

2. Background of the main section

/* 2. main section: background image + a transparent color layer over it */
.hero {
  background:
    linear-gradient(135deg, rgba(31, 42, 68, 0.9), rgba(221, 0, 34, 0.75)),
    url("../images/pozadina.jpg") center / cover no-repeat;
  min-height: 60vh;                 /* bar 60% visine ekrana */
  display: flex;
  align-items: center;              /* content vertically centered */
}
.hero h1 { text-shadow: 0 3px 12px rgba(0, 0, 0, 0.35); }
PropertyWhat it does
two backgrounds separated by a commathe first (a transparent color gradient) is above the second (the image) – the text is readable on any photo
center / cover no-repeatthe image is centered, covers the whole area and does not repeat
min-height: 60vhthe main section takes at least 60% of the screen height – no fixed height in pixels
display: flex; align-items: centercontent vertically centered (lesson Flexbox (SR))

3. Strip, gallery and effects

/* 3. strip with the steps */
.traka { background: linear-gradient(90deg, var(--lk-crvena), #ff6b81); }
.korak {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 1.25rem;
  height: 100%;
  transition: transform 0.2s, background 0.2s;
}
.korak:hover { transform: translateY(-4px); background: rgba(255, 255, 255, 0.22); }

/* 4. galerija */
#primeri { background: var(--lk-svetla); max-width: none; }
.logo-primer {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s;
}
.logo-primer:hover { transform: scale(1.05); }

transition says that the change does not happen abruptly but over 0.2 seconds, and transform: translateY(-4px) and scale(1.05) slightly lift and enlarge the element when the mouse is over it. Small effects make a site feel “alive”; too many effects make it tiring.

4. Footer and a button in the site color

/* 5. footer */
.podnozje { background: var(--lk-tamna); }
.podnozje a { color: #ffd6dc; text-decoration: none; }
.podnozje a:hover { color: #fff; text-decoration: underline; }

/* 6. button in the site color (Bootstrap 5.3 button variables) */
.btn-danger {
  --bs-btn-bg: var(--lk-crvena);
  --bs-btn-border-color: var(--lk-crvena);
  --bs-btn-hover-bg: #b0001b;
  --bs-btn-hover-border-color: #b0001b;
}

Bootstrap's red button (btn-danger) gets exactly our red by changing its variables – as in the lesson Bootstrap components (SR).

5. Phones and accessibility

/* 7. phone: smaller main section and title */
@media (max-width: 575.98px) {
  .hero { min-height: auto; }
  .hero h1 { font-size: 2.2rem; }
}

/* 8. users who do not want animations (system setting) */
@media (prefers-reduced-motion: reduce) {
  .korak, .logo-primer { transition: none; }
}

Bootstrap already adapts the column layout, so your own media query is needed only for what Bootstrap does not know – here a smaller title and main section on a phone. The prefers-reduced-motion query turns off animations for users who are bothered by them (a system setting).

Check: F12 → Ctrl+Shift+M → choose a phone (e.g. iPhone SE, width 375px) and go through the whole page: is everything readable, does the menu work, is there horizontal scrolling?

The complete main.css and the result

/* ===== css/main.css – Logo Kreator ===== */

/* 1. site colors in one place (CSS variables) */
:root {
  --lk-crvena: #dd0022;
  --lk-tamna: #1f2a44;
  --lk-svetla: #fff5f6;
}

body { font-family: "Segoe UI", system-ui, Arial, sans-serif; }

/* 2. main section: background image + a transparent color layer over it */
.hero {
  background:
    linear-gradient(135deg, rgba(31, 42, 68, 0.9), rgba(221, 0, 34, 0.75)),
    url("../images/pozadina.jpg") center / cover no-repeat;
  min-height: 60vh;                 /* bar 60% visine ekrana */
  display: flex;
  align-items: center;              /* content vertically centered */
}
.hero h1 { text-shadow: 0 3px 12px rgba(0, 0, 0, 0.35); }

/* 3. strip with the steps */
.traka { background: linear-gradient(90deg, var(--lk-crvena), #ff6b81); }
.korak {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 1.25rem;
  height: 100%;
  transition: transform 0.2s, background 0.2s;
}
.korak:hover { transform: translateY(-4px); background: rgba(255, 255, 255, 0.22); }

/* 4. galerija */
#primeri { background: var(--lk-svetla); max-width: none; }
.logo-primer {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s;
}
.logo-primer:hover { transform: scale(1.05); }

/* 5. footer */
.podnozje { background: var(--lk-tamna); }
.podnozje a { color: #ffd6dc; text-decoration: none; }
.podnozje a:hover { color: #fff; text-decoration: underline; }

/* 6. button in the site color (Bootstrap 5.3 button variables) */
.btn-danger {
  --bs-btn-bg: var(--lk-crvena);
  --bs-btn-border-color: var(--lk-crvena);
  --bs-btn-hover-bg: #b0001b;
  --bs-btn-hover-border-color: #b0001b;
}

/* 7. phone: smaller main section and title */
@media (max-width: 575.98px) {
  .hero { min-height: auto; }
  .hero h1 { font-size: 2.2rem; }
}

/* 8. users who do not want animations (system setting) */
@media (prefers-reduced-motion: reduce) {
  .korak, .logo-primer { transition: none; }
}
<!DOCTYPE html>
<html lang="sr">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Logo Creator – make your own logo</title>
  <meta name="description" content="A free generator of simple logos: type a name, choose a color and shape and download the image.">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="css/main.css">
</head>
<body>
  <!-- 1. MENU -->
  <nav class="navbar navbar-expand-md bg-dark" data-bs-theme="dark">
    <div class="container">
      <a class="navbar-brand fw-bold" href="naslovna.html">LOGO KREATOR</a>
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#meni" aria-label="Open the menu">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="meni">
        <ul class="navbar-nav ms-auto">
          <li class="nav-item"><a class="nav-link active" href="naslovna.html">Naslovna</a></li>
          <li class="nav-item"><a class="nav-link" href="#koraci">How it works</a></li>
          <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">Examples</a>
            <ul class="dropdown-menu dropdown-menu-end">
              <li><a class="dropdown-item" href="#primeri">Poslovni</a></li>
              <li><a class="dropdown-item" href="#primeri">Edukacija</a></li>
              <li><a class="dropdown-item" href="#primeri">Sport</a></li>
            </ul>
          </li>
        </ul>
      </div>
    </div>
  </nav>

  <!-- 2. MAIN SECTION (hero): title and form -->
  <header class="hero text-center text-white">
    <div class="container py-5">
      <h1 class="display-4 fw-bold">Logo Kreator</h1>
      <p class="lead mb-4">Make a simple logo in a minute – for free.</p>
      <form class="row g-2 justify-content-center" action="generator.html" method="get">
        <div class="col-12 col-sm-8 col-md-6">
          <label for="naziv" class="visually-hidden">Logo name</label>
          <input type="text" class="form-control form-control-lg" id="naziv" name="naziv"
                 placeholder="Type a name, e.g. Pupin club" maxlength="20" required>
        </div>
        <div class="col-12 col-sm-auto">
          <button type="submit" class="btn btn-danger btn-lg w-100">Create a logo</button>
        </div>
      </form>
    </div>
  </header>

  <main>
    <!-- 3. STRIP WITH THE STEPS -->
    <section id="koraci" class="traka text-white text-center">
      <div class="container py-4">
        <div class="row g-3">
          <div class="col-md-4"><div class="korak"><h2 class="h4">1. Type a name</h2><p class="mb-0">A name, a school or a club.</p></div></div>
          <div class="col-md-4"><div class="korak"><h2 class="h4">2. Choose a style</h2><p class="mb-0">Color, shape and font.</p></div></div>
          <div class="col-md-4"><div class="korak"><h2 class="h4">3. Download</h2><p class="mb-0">An image in PNG or SVG format.</p></div></div>
        </div>
      </div>
    </section>

    <!-- 4. PRIMERI LOGOA -->
    <section id="primeri" class="container py-5 text-center">
      <h2 class="mb-4">Examples of created logos</h2>
      <div class="row g-4 justify-content-center">
        <div class="col-6 col-md-4 col-lg-3"><img src="images/logo1.png" class="img-fluid rounded logo-primer" alt="Red round logo with the letters SP"></div>
        <div class="col-6 col-md-4 col-lg-3"><img src="images/logo2.png" class="img-fluid rounded logo-primer" alt="Blue square logo with the letters IT"></div>
        <div class="col-6 col-md-4 col-lg-3"><img src="images/logo3.png" class="img-fluid rounded logo-primer" alt="Green round logo with the letters FK"></div>
      </div>
    </section>
  </main>

  <!-- 5. FOOTER -->
  <footer class="podnozje text-white">
    <div class="container py-4">
      <div class="row text-center text-md-start g-3">
        <div class="col-md-4"><h3 class="h6 text-uppercase">Logo Kreator</h3><p class="small mb-0">A project from the HTML, CSS and JavaScript course.</p></div>
        <div class="col-md-4"><h3 class="h6 text-uppercase">Learning</h3>
          <a href="https://svetprogramiranja.com">World of Programming</a><br><a href="https://petlja.org">Petlja</a></div>
        <div class="col-md-4"><h3 class="h6 text-uppercase">Alati</h3>
          <a href="https://getbootstrap.com">Bootstrap</a><br><a href="https://developer.mozilla.org/sr/">MDN</a></div>
      </div>
      <p class="text-center small mt-3 mb-0">&copy; 2026 Logo Kreator</p>
    </div>
  </footer>

  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

Result:

There is no real background photo in the result, so only the color gradient is visible – with your own image images/pozadina.jpg it looks richer.

Practice tasks

Every task has an example, hints and a solution. The solutions have been checked in the browser.

TASK 01Difficulty: easy

A different theme in two lines

Change the site colors to a blue theme (main color #1f6feb, dark #0d1b2a) by changing only the variables in :root. What else has to change for the strip to be blue too?

TASK 02Difficulty: medium

A dark theme for the gallery

Add rules so that, when the user has the dark theme turned on in the system, the examples section has a dark background and a light heading.

Common mistakes and tips
  • A path to an image in CSS is relative to the CSS file: from css/main.css the image is at ../images/pozadina.jpg.
  • If a rule does not work, check in F12 whether a Bootstrap rule overrode it – and whether main.css is linked after Bootstrap.
  • Do not use fixed heights (height: 400px) for sections with text – on a phone the text does not fit; use min-height and padding.
  • Font sizes in vw (e.g. font-size: 1.2vw) become tiny on a phone – use rem or clamp().

Check your knowledge

Open the quiz

Custom styles

1. How is the CSS variable --lk-crvena used?




2. What does the path to an image look like from css/main.css if the image is in images/?




3. What does transition: transform 0.2s do?