Giter VIP home page Giter VIP logo

insure-landing-page's Introduction

Frontend Mentor - Insure landing page solution

Table of contents

Overview

Created a landing page for Insure insurance from a style guide provided, and added my own style changes.

The challenge

Users should be able to:

  • View the optimal layout for the site depending on their device's screen size
  • See hover states for all interactive elements on the page

Screenshot

Links

My process

  • I started by setting up the html layout working from a mobile design first.
  • I used grids often here, as a practice to become more familiar with them as well as flex intermingled.
  • The “squiggles” were added by setting their positions as absolute and working with top, left, height, and width to adjust their location. (In the same manner as when doing Pure CSS Art)
  • There were difficulties with the navbar as JS was still new to me so I had to watch a few videos to get it right (more into in the continued development section below).
  • Once I got to work through my desktop view, I had to hide several mobile-only images and upload the desktop ones. This was a first for me so I added all the elements I needed to the html and then used display: hidden in the respective view size. To unhide them I used a display block and adjusted the positions.
  • The desktop navigation was easier, I used a flex display here and added the hover effects to my links
  • I used flex for the footer as well to span out the sections to match what the style guide had.
  • Afterwards, I played around with some colors until I settled for blue (It seemed like the best fit for insurance) and I moved the main image to float to the left of

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Javascript
  • Mobile-first workflow

What I learned

  • I learned how to design with a mobile first workflow

  • I learned how to get a responsive hamburger nav that hides the links in mobile view until you click on the icon to display them.

  • Code I am proud of:

  <nav>
    <div class="nav-center">
        <!-- nav header-->
        <div class="nav-header">
            <img src="images/logo.svg" class="logo" alt="logo">
            <button class="nav-toggle">
                <i class="fa-solid fa-bars"></i>
            </button>
        </div>
        <!-- links -->
        <div class="links">
          <a href="#">How we work</a>
          <a href="#">Blog</a>
          <a href="#">Contact</a>
          <button class="link_btn"><a href="#">View Plans</a></button>
          </div>
    </div>
  </nav>
 .links {
    height: 0;
    overflow: hidden;
    transition: all 0.3s linear;
  }

  .show-links {
    height: 12rem;
    display: block;
  }
//target nav toggle and links
const navToggle = document.querySelector(".nav-toggle");
const links = document.querySelector(".links");

//use event listener for our click 
navToggle.addEventListener("click", function(){

  //3&4. How to add and remove the class
    if (links.classList.contains("show-links")) {
        links.classList.remove("show-links");
    }
   // if it is not true (if the class is not there):
    else{
        links.classList.add("show-links");
    }


    //links.classList.toggle("show-links");
});

Continued development

Something that was a challenge was the navigation in mobile view. I was not sure how to toggle my icon to show and hide my links. I failed using a few tutorials until I realized I just didn’t understand what my JavaScript code was saying. Thankfully I found a few lessons from FreeCodeCamp to practice JavaScript and a navigation practice happened to come up (Right on time! Thank Goodness 😊 ) so after learning some JavaScript I looked at this project with fresh eyes and got a successful navigation.

I plan to practice more JavaScript projects

Useful resources

insure-landing-page's People

Contributors

jud1th1 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.