In the digital age, it has become essential to show your skills, projects, and work online. If you are a student, web developer, freelancer, or searching a job, then you must have the personal portfolio. It helps to represent your skills, technical skills, education, work experience and show a collection of projects.
You need to have good knowledge of HTML, CSS, Javascript and web design to build a effective portfolio website. But in the modern era, you only need a prompt to make the good portfolio website.
In this article, you will learn about how build the personal portfolio with the help of AI and which AI tools to use and how to customized the website according to your need. At the end you will have a live website with a mobile menu, dark menu, a contact form, and scroll animations, and you understand how each part works.
Before You Start
You will need a code editor (ahem, Vs code, perhaps), a web browser and an AI chat assistant. It is helpful for some knowledge of HTML, CSS and JavaScript helps. If you are new or beginner, read the HTML tutorial, CSS tutorial and JavaScript tutorial first.
First, you create a folder named portfolio with three empty files.
portfolio/
├── index.html
├── style.css
└── script.js
5 Rules for Writing Good Code Prompts
When you use the AI to generate code, you need to write a clear understandable prompt. If you write clearly what you need then AI give the best output. There are five important rules to follow when writing a good prompt.
1. Ask for one thing at a time:
You do not modify or changes the entire code at once. You write the prompt one by one that is easier to make the websites.
2. Write name of the technology Used:
You write the name of the technology in the prompt. For example, Use only the HTML, CSS, and JavaScript code not any use framework.
3. Clearly Explain What you Need:
You write the prompt clearly what you need like sections and features. For example, Home, About, Projects, and contact.
For example, if you are creating a portfolio website, specify that it should include Home, About, Projects, and Contact sections. You can also explain how each section should look and work.
4. Set Limits:
If you want to improve the existing code then tells which part you want to modify. For example: "Improve only the navigation bar. Do not modify the header, footer, or other sections."
5. Paste your current code:
If you want to add a new features of the particular section, paste your current code into the prompt. The AI understand yur existing code structure and add the required changes without unnecessary modifying other parts of your project.
Step 1: Create the HTML Structure
First, we start with HTML language only, so the page has all its content before we add any design.
Prompt 1
Create a personal portfolio website using only HTML. I am a beginner, so keep the code clean and simple.
Create one file: index.html. Include:
- A header with a logo and navigation links (About, Skills, Projects, Contact)
- A hero section with my name, role, a short tagline and a "View My Work" button
- An About section with a short paragraph
- A Skills section with 6 skills in a list
- A Projects section with 3 project cards (title, description, link)
- A Contact section with a form (name, email, message, submit button)
- A footer
Use semantic tags. Link style.css and script.js. Use the placeholder name "Riya Sharma". Do not add any CSS or JavaScript yet.
Code (index.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Riya Sharma | Web Developer</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header class="navbar">
<a href="#home" class="logo">Riya.dev</a>
<nav>
<ul class="nav-links">
<li><a href="#about">About</a></li>
<li><a href="#skills">Skills</a></li>
<li><a href="#projects">Projects</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section id="home" class="hero">
<p>Hi, I'm</p>
<h1>Riya Sharma</h1>
<h2>Aspiring Web Developer</h2>
<p class="tagline">I build simple, fast and responsive websites.</p>
<a href="#projects" class="btn">View My Work</a>
</section>
<section id="about">
<h2 class="section-title">About Me</h2>
<p>I am a computer science student who loves turning ideas into working websites. I am learning HTML, CSS, JavaScript and Python, and I enjoy building small projects every week.</p>
</section>
<section id="skills">
<h2 class="section-title">Skills</h2>
<ul class="skills-list">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>Python</li>
<li>Git</li>
<li>SQL</li>
</ul>
</section>
<section id="projects">
<h2 class="section-title">Projects</h2>
<div class="projects-grid">
<article class="card">
<h3>To-Do List App</h3>
<p>Add, complete and delete tasks.</p>
<a href="#">View Project</a>
</article>
<article class="card">
<h3>Weather App</h3>
<p>Shows live weather for any city.</p>
<a href="#">View Project</a>
</article>
<article class="card">
<h3>Quiz App</h3>
<p>A multiple-choice quiz with a score.</p>
<a href="#">View Project</a>
</article>
</div>
</section>
<section id="contact">
<h2 class="section-title">Contact Me</h2>
<form id="contact-form">
<input type="text" id="name" placeholder="Your name">
<input type="email" id="email" placeholder="Your email">
<textarea id="message" placeholder="Your message"></textarea>
<button type="submit" class="btn">Send Message</button>
<p id="form-message"></p>
</form>
</section>
</main>
<footer>
<p>© 2026 Riya Sharma. All rights reserved.</p>
</footer>
<script src="script.js"></script>
</body>
</html>
Step 2: Add the Design with CSS
Prompt 2
Here is my index.html: [paste your HTML]
Write style.css for it. Requirements:
- Modern, clean look with a white background and indigo (#4f46e5) as the main colour
- Use CSS variables for colours so I can add dark mode later
- Sticky navbar with the logo on the left and links on the right
- Full-height hero section
- Skills shown as rounded pills
- Projects in a responsive grid with a hover lift effect
- A neat contact form
- Smooth scrolling
Only give me CSS. Do not change my HTML.
Code (style.css)
:root {
--bg: #ffffff;
--text: #1f2937;
--muted: #6b7280;
--primary: #4f46e5;
--card: #f3f4f6;
--border: #e5e7eb;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
font-family: "Segoe UI", Arial, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
/* Navbar */
.navbar {
position: sticky; top: 0; z-index: 10;
display: flex; justify-content: space-between; align-items: center;
padding: 16px 8%;
background: var(--bg);
border-bottom: 1px solid var(--border);
}
.logo { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a:hover { color: var(--primary); }
/* Sections */
section { padding: 80px 8%; }
.section-title { text-align: center; font-size: 2rem; margin-bottom: 40px; }
#about p { max-width: 700px; margin: 0 auto; text-align: center; color: var(--muted); }
/* Hero */
.hero { min-height: 90vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.hero h1 { font-size: 3.2rem; }
.hero h2 { font-size: 1.6rem; color: var(--primary); margin-bottom: 12px; }
.tagline { color: var(--muted); margin-bottom: 24px; }
.btn {
display: inline-block;
background: var(--primary); color: #fff;
padding: 12px 28px; border: none; border-radius: 8px;
font-size: 1rem; cursor: pointer;
}
.btn:hover { opacity: 0.9; }
/* Skills */
.skills-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.skills-list li {
background: var(--card); border: 1px solid var(--border);
padding: 10px 22px; border-radius: 30px;
}
/* Projects */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.card {
background: var(--card); border: 1px solid var(--border);
padding: 24px; border-radius: 12px;
transition: transform 0.25s;
}
.card:hover { transform: translateY(-6px); }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); margin-bottom: 14px; }
.card a { color: var(--primary); font-weight: 600; }
/* Contact form */
form { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
input, textarea {
padding: 12px; font: inherit;
border: 1px solid var(--border); border-radius: 8px;
background: var(--bg); color: var(--text);
}
textarea { min-height: 130px; resize: vertical; }
#form-message { text-align: center; font-weight: 600; }
footer { text-align: center; padding: 24px; border-top: 1px solid var(--border); color: var(--muted); }
Step 3: Make the Navbar Work on Mobile
Prompt 3
My portfolio navbar does not fit on mobile screens. Add a hamburger menu that appears below 768px.
- Give me the HTML for the menu button
- Give me the extra CSS (use my existing CSS variables)
- Give me the JavaScript to open and close the menu, and close it when a link is clicked
Use plain JavaScript. Show only the new code and tell me where to paste it.
HTML:
Add this button inside the header, right after the closing </nav> tag.
<button class="menu-toggle" aria-label="Toggle menu">☰</button>
CSS:
add at the end of style.css.
.menu-toggle { display: none; background: none; border: none; font-size: 1.8rem; color: var(--text); cursor: pointer; }
@media (max-width: 768px) {
.menu-toggle { display: block; }
.nav-links {
display: none;
position: absolute; top: 100%; left: 0; width: 100%;
flex-direction: column; align-items: center; gap: 18px;
padding: 20px 0;
background: var(--bg);
border-bottom: 1px solid var(--border);
}
.nav-links.open { display: flex; }
.hero h1 { font-size: 2.4rem; }
}
JavaScript (script.js)
const menuToggle = document.querySelector(".menu-toggle");
const navLinks = document.querySelector(".nav-links");
menuToggle.addEventListener("click", () => {
navLinks.classList.toggle("open");
});
navLinks.querySelectorAll("a").forEach((link) => {
link.addEventListener("click", () => navLinks.classList.remove("open"));
});
Step 4: Add Dark Mode
Prompt 4
Add a dark mode toggle to my portfolio. It should:
- Use my existing CSS variables
- Show a button in the navbar (moon icon in light mode, sun icon in dark mode)
- Remember the choice using localStorage
Show me only the new HTML, CSS and JavaScript, and where each piece goes.
HTML:
add this as the last item inside the <ul class="nav-links"> list.
<li><button id="theme-toggle" class="theme-toggle" aria-label="Switch theme">🌙</button></li>
CSS:
add at the end of style.css.
body.dark {
--bg: #0f172a;
--text: #e2e8f0;
--muted: #94a3b8;
--card: #1e293b;
--border: #334155;
}
.theme-toggle {
background: none; color: var(--text);
border: 1px solid var(--border); border-radius: 50%;
width: 38px; height: 38px;
font-size: 1.1rem; cursor: pointer;
}
JavaScript:
add at the end of script.js.
const themeToggle = document.getElementById("theme-toggle");
if (localStorage.getItem("theme") === "dark") {
document.body.classList.add("dark");
themeToggle.textContent = "☀️";
}
themeToggle.addEventListener("click", () => {
const isDark = document.body.classList.toggle("dark");
themeToggle.textContent = isDark ? "☀️" : "🌙";
localStorage.setItem("theme", isDark ? "dark" : "light");
});
Step 5: Add Your Real Projects
Placeholder projects do not make a good impression. This prompt improves your project cards by adding technology tags and two links to each project.
Prompt 5
In my index.html, replace the three project cards with better ones. Keep the same class names and structure. For each card add: a title, a 2-line description, a row of technology tags, and two links (Live Demo and GitHub).
My projects: 1) To-Do List App (HTML, CSS, JavaScript) 2) Weather App (JavaScript, API) 3) Quiz App (HTML, CSS, JavaScript).
Also give me the CSS for the tags. Show only the updated Projects section and the new CSS.
Example card (HTML)
<article class="card">
<h3>To-Do List App</h3>
<p>A task manager where users can add, complete and delete tasks. Tasks are saved in the browser.</p>
<div class="tags"><span>HTML</span><span>CSS</span><span>JavaScript</span></div>
<a href="#">Live Demo</a>
<a href="#">GitHub</a>
</article>
CSS
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tags span {
font-size: 0.8rem; padding: 4px 10px; border-radius: 20px;
background: var(--bg); border: 1px solid var(--border);
}
.card a { margin-right: 14px; }
Replace each # with the real link to your project. If you do not have projects yet, build them from our AI Projects series and link them here.
Step 6: Validate the Contact Form
Prompt 6
Add JavaScript validation to my contact form (ids: contact-form, name, email, message, form-message).
- Stop the page from reloading on submit
- Show an error if any field is empty
- Show an error if the email format is invalid
- Show a success message and clear the form if everything is correct
Use plain JavaScript and show only the JS and the CSS for error/success colours.
JavaScript:
add at the end of script.js.
const form = document.getElementById("contact-form");
const formMessage = document.getElementById("form-message");
form.addEventListener("submit", (event) => {
event.preventDefault();
const name = document.getElementById("name").value.trim();
const email = document.getElementById("email").value.trim();
const message = document.getElementById("message").value.trim();
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!name || !email || !message) {
showMessage("Please fill in all fields.", "error");
} else if (!emailPattern.test(email)) {
showMessage("Please enter a valid email address.", "error");
} else {
showMessage("Thanks for reaching out, " + name + "!", "success");
form.reset();
}
});
function showMessage(text, type) {
formMessage.textContent = text;
formMessage.className = type;
}
CSS:
add at the end of style.css.
.error { color: #dc2626; }
.success { color: #16a34a; }
Important: This form only checks the information entered by the user. It does not send any emails yet. If you want to receive messages through this form, you need to connect it to a free service like Formspree or EmailJS.
You can ask your AI to do this by using the following prompt:
"Connect my contact form to Formspree. Here is my form and JavaScript code: [paste code]."
The AI can then help you connect your form to Formspree so that you can receive messages in your email.
Step 7: Add Scroll Animations
Prompt 7
Add a subtle fade-in and slide-up animation to each section (except the hero) when it scrolls into view. Use the IntersectionObserver API and plain CSS. Add the animation class with JavaScript so the content stays visible if JavaScript fails. Show only the new CSS and JavaScript.
CSS:
add at the end of style.css.
.reveal {
opacity: 0;
transform: translateY(30px);
transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: none; }
JavaScript:
add at the end of script.js.
const sections = document.querySelectorAll("section:not(.hero)");
sections.forEach((section) => section.classList.add("reveal"));
const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add("visible");
observer.unobserve(entry.target);
}
});
}, { threshold: 0.15 });
sections.forEach((section) => observer.observe(section));
Step 8: Polish for Search Engines and Accessibility
Prompt 8
Review my index.html for SEO and accessibility. Add a meta description, Open Graph tags and a theme colour. Check headings, labels and button names. Do not change the design. List every change you made.
Add these lines inside <head> (edit the text to match you):
<meta name="description" content="Portfolio of Riya Sharma, a web developer building responsive websites with HTML, CSS and JavaScript.">
<meta property="og:title" content="Riya Sharma | Web Developer">
<meta property="og:description" content="Projects and skills of Riya Sharma, aspiring web developer.">
<meta name="theme-color" content="#4f46e5">Also make sure every image you add has an alt attribute, and every form field has a clear placeholder or label.
Publish Your Portfolio for Free
You can make your portfolio website available online without paying for hosting.
Option 1: Using GitHub Pages
- First, log in to your GitHub account and create a new repository. You can give it a name like portfolio.
- Upload your website files, such as index.html, style.css, and script.js, to the repository.
- Open your repository and go to Settings → Pages.
- Under the Build and deployment section, select Deploy from a branch. Then choose the main branch and / (root) folder.
- Click Save and wait for a minute or two. GitHub will publish your website and provide a live link.
Your portfolio will be available at the following URL:
https://your-username.github.io/portfolio/
Replace your-username with your actual GitHub username to get your website link.
Option 2: Using Netlify Drop
Netlify Drop is another simple way to publish your portfolio website for free. You do not need to configure any complicated settings or connect a GitHub repository.
- Open Netlify Drop in your browser.
- Select your portfolio folder from your computer.
- Drag and drop the folder onto the Netlify Drop page.
- Wait a few seconds while Netlify uploads and publishes your website.
- Once the process is complete, Netlify will provide a live website link that you can share with others.
See the Live Demo
I built this portfolio exactly as shown in this tutorial and hosted it on Netlify so you can see the final result. Open it on your phone and your laptop, try the dark mode toggle, the mobile menu and the contact form validation, then compare it with your own version.
Live demo: https://codingroute-portfolio-project.netlify.app
If your version looks different, check the "Common Problems and Fix Prompts".
Common Problems and Fix Prompts
| Problem | What to check | Prompt to fix it |
|---|---|---|
| CSS is not applying | File names and the <link> tag path must match exactly | "My CSS is not loading. Here is my HTML head and folder structure: [paste]. What is wrong?" |
| Menu button does nothing | Class names in HTML, CSS and JS must be identical | "My hamburger menu does not open. Here is my HTML, CSS and JS: [paste]. Find the bug." |
| Dark mode does not change everything | Some colours are hard-coded instead of using variables | "Find colours in my CSS that are not using variables and fix them." |
| AI rewrote my whole file | Your prompt did not set limits | "Only change the navbar. Do not touch any other part of the code." |
| Error in the browser console | Press F12 and open the Console tab | "I get this error: [paste error]. Here is my code: [paste]. Explain the cause and the fix." |
What You Learned
In this tutorial, you learned how to build a complete responsive portfolio website using Semantic HTML, CSS variables, and media queries. Additionally, you explored how to work with DOM events, localStorage, form validation, and the IntersectionObserver API in JavaScript. You also learned an essential approach for working with AI, which includes crafting concise and clear prompts, generating code using AI, and testing that code effectively.
Next Project
Looking for more? Check out the tutorials below in our AI Projects series to discover new projects and add more projects to your portfolio as you complete them. This will help you improve your skills, gain practical experience, and build a strong portfolio to showcase your work.