GithubHelp home page GithubHelp logo

hassanidris / news-homepage Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.32 MB

Home Page: https://hassanidris.github.io/news-homepage/

SCSS 40.07% CSS 32.72% JavaScript 1.67% HTML 25.54%
css css-variables sass vanilla-javascript

news-homepage's Introduction

Frontend Mentor - News homepage solution

This is a solution to the News homepage challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

Screenshot

Screenshot 2023-05-21 at 04 32 29

Links

My process

Built with

  • SASS / CSS Variables
  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Mobile-first workflow

What I learned

  • CSS Variables
:root {
  //  ### Primary
  --clr-prm-400-softOrange: hsl(35, 77%, 62%);
  --clr-prm-400-softRed: hsl(5, 85%, 63%);

  //  ### Neutral
  --clr-nut-100-offWhite: hsl(36, 100%, 99%);
  --clr-nut-200-grayishBlue: hsl(233, 8%, 79%);
  --clr-nut-600-darkGrayishBlue: hsl(236, 13%, 42%);
  --clr-nut-900-veryDarkBlue: hsl(240, 100%, 5%);

  //  ## Typography
  --ff-inter: "Inter", sans-serif;

  --fw-normal: 400;
  --fw-bold: 700;
  --fw-extraBold: 800;

  --fs-400: 0.9375rem; // body font
  --fs-500: 1rem; // buttons font
  --fs-600: 1.125rem; // h4
  --fs-700: 1.25rem; // h3
  --fs-800: 1.9rem; // h2
  --fs-900: 2.5rem; // h1
}
  • Nesting media queries inside the classes
.showcase {
  @media (min-width: 768px) {
    grid-column: 1 / span 2;
  }

  &__content {
    margin: 1.25rem 0;

    @media (min-width: 768px) {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 2rem;
    }
  }

  &__title {
    font-size: var(--fs-900);
    font-weight: var(--fw-extraBold);
    color: var(--clr-nut-900-veryDarkBlue);
  }

  &__desc {
    margin-bottom: 1rem;
    color: var(--clr-nut-600-darkGrayishBlue);
  }

  &__btn {
    background-color: var(--clr-prm-400-softRed);
    color: var(--clr-nut-100-offWhite);
    font-size: var(--fs-500);
    padding: 0.8rem 2rem;
    border: none;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    font-weight: var(--fw-bold);
    transition: all 0.3s ease-in-out;

    &:hover {
      background-color: var(--clr-nut-900-veryDarkBlue);
      cursor: pointer;
    }
  }
}
  • Vanilla Javascript for menu in mobile
const navbar = document.querySelector("nav");
const openMenu = document.getElementById("menu-btn");
const closeMenu = document.getElementById("menu-close");

openMenu.addEventListener("click", () => {
  navbar.classList.add("open");
});

closeMenu.addEventListener("click", () => {
  navbar.classList.remove("open");
});

Author

news-homepage's People

Contributors

hassanidris avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.