Giter VIP home page Giter VIP logo

frontend-mentor-developer-portfolio's Introduction

Frontend Mentor - Single-page developer portfolio solution

This is my solution to the Single-page developer portfolio challenge on Frontend Mentor.

Table of contents

Overview

This project is more complicated than it looks like, especially for the hero part, there are some moving elements like the profile photo and a circle(decoration). Also font size is changing depends on the screen size.

What I learned

basic HTML

  • line-height: using numbers, so when element's font-size change, the line height will be reflected properly

  • when the width of the content is contained in the middle of the page, use a general class "wrapper" to limit the width, and apply it to different sections of the page, e.g header, main,footer

:root {
  --view-width: calc(100vw - 2rem);
}
.wrapper {
  width: var(--view-width);
  max-width: var(--max-width);
  margin: 0 auto;

  /* center the content inside this container */
  display: grid;
  place-items: center;

  padding: 2rem 0;
}

@media screen and (min-width: 700px) {
  .wrapper {
    --view-width: calc(100vw - 3.75rem);
  }
}

style anchor tag/link as a button (in this project, link appear as has a green underline)

<a href="#contact" class="btn">Contact me</a>
.btn {
  padding: 0.5rem 0;
  border: none;
  border-bottom: 2px solid var(--clr-accent);

  text-transform: uppercase;
  color: var(--clr-white);
  font-size: 1rem;
  letter-spacing: 2.29px;
  line-height: 26px;
  font-weight: var(--font-bold);
}
.btn:hover {
  color: var(--clr-accent);
}

typography for responsive design

using clamp, the logo text is 24px on mobile and 32px on tablet https://royalfig.github.io/fluid-typography-calculator/ min font size: 24px min viewport: 375px max font size: 32px max viewport: 768px

.logo {
  font-size: 1.5rem;
  font-size: clamp(1.5rem, 1.02rem + 2.035vw, 2rem);
  font-weight: var(--font-bold);
}

using different profile images based on screen size.

    <picture>
      <source
        media="(min-width: 62.5em)"
        srcset="./images/image-profile-desktop.webp"/>
      <source
        media="(min-width: 37.5em)"
        srcset="./images/image-profile-tablet.webp" />
      <img class="profile-img" src="./images/image-profile-mobile.webp"     alt="profile image"
        width="174"
        height="383"
      />
    </picture>

draw a horizontal line as separation between setions, we can use
or border-bottom on the section

hr {
  border: none;
  border-top: 1px solid var(--clr-white);
  width: var(--view-width);
  max-width: var(--max-width);
}

to center an item with postion:absolute

.hero__img {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
}

or

.hero__img {
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50%; /* transform: translateX(-50%) */
}

hover effect over the project part

when mouse over, picture will have a dark overlay shade and the link button is moved into the middle of the project image location. use opacity to control the visibility of an element.

@media screen and (min-width: 62.5em) {
  .project__picture {
    position: relative;
  }

  .project__picture::after {
    content: "";
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: hsl(0, 0%, 0%);
    opacity: 0;
    transition: opacity var(--transition);
  }
  .project:hover .project__picture::after {
    opacity: 0.5;
  }
}

basic form validation without javascript

.contact__invalid-icon {
  display: none;
  position: absolute;
  bottom: 1rem;
  right: 0;
}
.contact input:focus-visible:invalid ~ .contact__invalid-icon,
.contact textarea:focus-visible:invalid ~ .contact__invalid-icon {
  display: inline-block;
}

Useful resources

I took reference to youtuber thecodercoder's github code. She has 4-part video for this project, however they are very long videos, I skipped most part of the videos because they look like recorded live stream without editing and you will watch her spending 30min to troubleshooting a minor issue.

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.