Portfolio Website Using Html Css And Javascript Source Code

Portfolio Website Using Html Css And Javascript Source Code

8 min read Jun 18, 2024
Portfolio Website Using Html Css And Javascript Source Code

Building a Portfolio Website Using HTML, CSS, and JavaScript: A Beginner's Guide

This article will guide you through the process of creating your own portfolio website using fundamental web development technologies: HTML, CSS, and JavaScript. We'll cover the essential elements, structure, and functionality to showcase your skills and projects in an appealing and interactive manner.

1. Planning Your Portfolio Website

Before diving into the code, it's crucial to have a clear vision of your portfolio website. Consider the following:

  • Target audience: Who are you trying to reach with your portfolio? This will help you tailor your content and design.
  • Content: What skills, projects, and experiences do you want to highlight? Organize your content into logical sections.
  • Design: Choose a style and layout that reflects your personality and the type of work you do.
  • Features: Determine if you need any interactive elements like contact forms, image galleries, or animations.

2. Setting Up Your Project

  1. Create a new folder: This folder will hold all the files for your project.
  2. Create an HTML file: Name it index.html (or a similar name). This file will be the main page of your website.
  3. Create a CSS file: Name it style.css. This file will contain all the styling for your website.
  4. Create a JavaScript file: Name it script.js. This file will handle any interactive features or dynamic behavior.

3. Building the HTML Structure

Your index.html file will be the backbone of your website. Here's a basic structure:

    Your Portfolio Website


Your Name

About Me

Write a brief introduction about yourself and your skills.


Project Image

Project Title

Brief description of the project.

View Project


© Your Name 2023

This code sets up the basic structure of your website, including a header, main content area, and footer. You can add more sections and elements based on your needs.

4. Styling with CSS

In your style.css file, you can style the elements of your website. Here's an example:

body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f2f2f2;

header {
    background-color: #333;
    color: #fff;
    padding: 20px;
    text-align: center;

h1 {
    margin: 0;

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;

nav li {
    display: inline-block;
    margin: 0 10px;

nav a {
    text-decoration: none;
    color: #fff;

section {
    padding: 20px;
    text-align: center;

.project {
    background-color: #fff;
    border-radius: 5px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);

footer {
    background-color: #333;
    color: #fff;
    padding: 10px;
    text-align: center;
    position: fixed;
    bottom: 0;
    width: 100%;

This code sets the basic styling for your website, including colors, fonts, spacing, and layout. You can customize these styles to create your unique design.

5. Adding JavaScript for Interactivity

In your script.js file, you can add JavaScript code to make your website more interactive. For example, you could:

  • Create a smooth scrolling animation: When a user clicks on a navigation link, scroll smoothly to the corresponding section.
  • Add a contact form validation: Ensure the user enters valid information in the contact form.
  • Implement an image gallery: Create a slideshow or a grid of images to showcase your projects.

Here's a simple JavaScript example for smooth scrolling:

const navLinks = document.querySelectorAll('nav a');

navLinks.forEach(link => {
    link.addEventListener('click', function(event) {
        const targetId = this.getAttribute('href');
        const targetElement = document.querySelector(targetId);
        targetElement.scrollIntoView({ behavior: 'smooth' });

This code adds an event listener to each navigation link, and when clicked, it scrolls smoothly to the corresponding section.

6. Deploying Your Portfolio Website

Once you're happy with your website, you can deploy it to a web server. There are various hosting services available, such as GitHub Pages, Netlify, or Vercel. These services allow you to easily deploy your static website with just a few steps.


By following these steps, you can build a professional and visually appealing portfolio website that showcases your skills and projects effectively. Remember to personalize your website with your own content, design, and functionality to create a unique representation of your work.