CodeYantra
BUILD WITH ME · DAY 6 / 7

Portfolio Page

Pichhle 5 din me jo banaya, aaj sab ko jod ke tumhara apna portfolio banega — navbar (Day 2), avatar (Day 1), aur tumhare projects ke cards. Kal (Day 7) isi page ko internet par LIVE karenge. 🚀

⏱ 30 min🎯 HTML + CSS + JS🛠 Day 1–5 ko jod ke ek site
  • Purane code ko reuse karna — asli developer yahi karte hain
  • repeat(auto-fit, minmax(180px, 1fr)) — bina media query ke responsive grid
  • <section id="projects"> + href="#projects" — same page par jump
  • scroll-behavior: smooth — jump nahi, smooth scroll
  • new Date().getFullYear() — footer me hamesha sahi saal

Aaj yeh banega 👇

Step by step

Har step me "Editor me daalo" dabao — ya best: khud type karo, haath se likha code yaad rehta hai. ✍️

1Navbar (Day 2 se)index.html

  • Day 2 ka navbar — bas links ab #projects, #skills, #contact par jaate hain.
  • href="#projects" us element par le jaata hai jiska id="projects" hai.
  <nav class="nav">
    <a class="logo" href="#">Aarav<span>.dev</span></a>
    <button class="menu-btn" id="menuBtn"></button>
    <ul class="links" id="links">
      <li><a href="#projects">Projects</a></li>
      <li><a href="#skills">Skills</a></li>
      <li><a href="#contact">Contact</a></li>
    </ul>
  </nav>

2Heroindex.html

  • Day 1 wala gol AK avatar + ek line me tum kaun ho.
  <header class="hero">
    <div class="avatar">AK</div>
    <h1>Hi, I'm Aarav 👋</h1>
    <p>BCA student · I build web apps with JavaScript.</p>
    <a class="btn" href="#projects">See my work</a>
  </header>

3Projectsindex.html

  • Har project ek .card — emoji, naam aur ek line.
  • Apne asli projects ke naam likho. Kal inhe live links bhi denge.
  <section id="projects">
    <h2>My Projects</h2>
    <div class="grid">
      <div class="card">
        <span>🪪</span><h3>Profile Card</h3>
        <p>HTML + CSS basics</p>
      </div>
      <div class="card">
        <span></span><h3>To-do App</h3>
        <p>DOM + localStorage</p>
      </div>
      <div class="card">
        <span>🧠</span><h3>Quiz App</h3>
        <p>Arrays + events</p>
      </div>
      <div class="card">
        <span></span><h3>Weather App</h3>
        <p>fetch + live API</p>
      </div>
    </div>
  </section>

4Skills + contactindex.html

  • Skills chhote "chips" me, aur footer me email + saal.
  <section id="skills">
    <h2>Skills</h2>
    <div class="chips">
      <span>HTML</span><span>CSS</span>
      <span>JavaScript</span><span>Git</span>
    </div>
  </section>

  <footer id="contact">
    <p>📧 aarav@example.com</p>
    <p>© <span id="year"></span> Aarav Kumar</p>
  </footer>

5Base + navbar CSS (Day 2 se)style.css

  • html { scroll-behavior: smooth } — menu link dabao to page smooth scroll karega.
  • Navbar par z-index: 10 — scroll karte waqt cards ke upar rahe.
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: sans-serif;
  background: #0f172a;
  color: #fff;
}

/* ---- navbar (Day 2 se) ---- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo {
  font-size: 24px;
  font-weight: bold;
  color: #0f172a;
  text-decoration: none;
}
.logo span { color: #ec4899; }
.links {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.links a {
  color: #0f172a;
  text-decoration: none;
  font-weight: 600;
}
.menu-btn {
  display: none;
  font-size: 28px;
  background: none;
  border: 0;
  cursor: pointer;
}

6Hero CSSstyle.css

  • Avatar thoda bada (110px), baaki Day 1 + Day 2 wala style.
/* ---- hero (Day 1 ka avatar) ---- */
.hero { text-align: center; padding: 64px 20px; }
.avatar {
  width: 110px;
  height: 110px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  font-size: 40px;
  font-weight: bold;
}
.hero h1 { font-size: 40px; margin: 0 0 8px; }
.hero p { color: #94a3b8; }
.btn {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 24px;
  border-radius: 999px;
  background: #6366f1;
  color: #fff;
  text-decoration: none;
}

7Projects grid — auto-fit 🔥style.css

  • section ki max-width: 900px + margin: 0 auto — bade screen par content beech me.
  • repeat(auto-fit, minmax(180px, 1fr)) = "jitne 180px ke cards fit ho sakein, utne columns bana do". Laptop par 4, phone par 1 — bina media query!
  • .card:hover par translateY(-6px) — card thoda upar uthta hai ✨
/* ---- projects grid ---- */
section {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}
h2 { font-size: 28px; }
.grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.card {
  padding: 20px;
  border-radius: 16px;
  background: #1e293b;
  transition: transform 0.2s;
}
.card:hover { transform: translateY(-6px); }
.card span { font-size: 32px; }
.card h3 { margin: 8px 0 4px; }
.card p { margin: 0; color: #94a3b8; }

8Skills + footerstyle.css

  • flex-wrap: wrap — chips jagah khatam hone par agli line me chale jaate hain.
/* ---- skills + footer ---- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips span {
  padding: 8px 16px;
  border-radius: 999px;
  background: #312e81;
}
footer {
  text-align: center;
  padding: 32px;
  color: #94a3b8;
  border-top: 1px solid #1e293b;
}

9Mobile CSS (Day 2 se)style.css

  • Day 2 wali media query — phone par ☰ menu.
/* ---- mobile (Day 2 se) ---- */
@media (max-width: 600px) {
  .menu-btn { display: block; }
  .links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: #fff;
  }
  .links.open { display: flex; }
  .links a {
    display: block;
    padding: 14px 24px;
    border-top: 1px solid #e2e8f0;
  }
}

10Mobile menu JS (Day 2 se)script.js

  • Wahi 5 line ka toggle.
// Mobile menu (Day 2 se)
const menuBtn = document.querySelector('#menuBtn');
const links = document.querySelector('#links');

menuBtn.addEventListener('click', () => {
  links.classList.toggle('open');
  const isOpen = links.classList.contains('open');
  menuBtn.textContent = isOpen ? '✕' : '☰';
});

11Link click + auto yearscript.js

  • Phone par menu ka link dabao → page scroll ho aur menu band ho jaaye.
  • new Date().getFullYear() — 2027 me bhi footer khud 2027 dikhayega.
// Link par click → menu band
links.querySelectorAll('a').forEach(a => {
  a.addEventListener('click', () => {
    links.classList.remove('open');
    menuBtn.textContent = '☰';
  });
});

// Footer me hamesha is saal ka year
document.querySelector('#year').textContent =
  new Date().getFullYear();

Tumhara editor 💻

code isi device par save hota hai

Ab ise apna banao 🎨

Atak gaye? Notes padho 📚

Aage kya?

Naya day aate hi reel aayegi — @codeyantra follow karo 🔔