Creating a Responsive Portfolio Website with HTML, CSS, and JavaScript

Responsive Portfolio Website

In today’s digital age, having a responsive portfolio website is crucial for showcasing your work and skills to potential clients and employers. A responsive portfolio website looks great on any device and provides a seamless user experience. This guide will walk you through creating a responsive portfolio website using HTML, CSS, and JavaScript.

Check Out Those Useful Articles

Understanding the Basics of Responsive Design

Responsive design is fundamental to modern web development, ensuring a website delivers an optimal viewing experience across various devices. This approach hinges on using media queries to detect the device’s screen size accessing the site, enabling developers to apply different styling rules based on this information. 

By utilizing flexible grids, layouts adapt seamlessly to the screen, whether a desktop, tablet, or smartphone, ensuring content is readable and accessible. Fluid images are another cornerstone, scaling appropriately to fit the container’s size, preventing distortion or loss of quality. 

Embracing these principles allows for creating websites that respond to the user’s environment, providing a consistent and engaging user experience regardless of how they access your site. Implementing responsive design techniques early in the development process establishes a solid foundation for a portfolio website that is genuinely accessible to all.

Setting Up Your Project Structure

Kickstarting your responsive portfolio website begins with organizing your project’s foundation. Start by creating a leading directory dedicated to your project. 

Within this directory, establish at least three crucial files: an index.html file, which will serve as the skeleton of your website; a style.css file, to breathe life into your website’s appearance; and a main.js file, where you’ll script the interactive elements that enhance user engagement. 

Organizing your files from the outset streamlines the development process and helps maintain clarity as your project grows. Additionally, consider creating subdirectories for assets such as images or fonts, ensuring these resources are neatly categorized and easily accessible. Setting up a well-structured project folder is paramount in building a solid foundation for your responsive portfolio website.

Crafting the HTML Structure

To lay the groundwork for your responsive portfolio website, begin with a comprehensive HTML structure that delineates your site’s various sections such as your biography, a gallery showcasing your projects, your contact details, and any other essential information you wish to share. Utilize semantic HTML5 tags—such as, —to enhance both accessibility and search engine optimization (SEO). 

It’s essential to structure your content logically to facilitate easy user navigation. For instance, your portfolio section could be arranged in a grid layout using tags wrapped in a tag, each representing a different project. Remember to include tags in the section of your document for responsiveness, such as the viewport tag which ensures your site scales correctly on various devices. 

By prioritizing semantic markup and logical structure from the start, you’ll create a strong foundation for the responsive and user-friendly portfolio website you aim to build.

First, copy the HTML code below and paste the codes into your index.html file.

				
					<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responsive Portfolio Website by AbdulDev</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <header>
        <a href="#" class="logo">Abdul<span>Dev</span></a>
        <div class="menuToggle"></div>
        <ul class="nav">
            <li class="active"><a href="#home">Home</a></li>
            <li><a href="#about">About</a></li>
            <li><a href="#services">Services</a></li>
            <li><a href="#portfolio">Portfolio</a></li>
            <li><a href="#contact">Contact</a></li>
        </ul>
    </header>
    <section id="home">
        <div class="content">
            <h2>Abdul Mabud</h2>
            <p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Nam consectetur nesciunt aut minima, eum, ipsam, repellat incidunt odit velit facilis assumenda corporis iure temporibus fugit?</p>
            <a href="#" class="btn">Download CV</a>
        </div>
        <img decoding="async" src="Images/hero-men.png" alt="Men" class="men">
    </section>
    <section id="about">
        <div class="secText">
            <h2>Who I am</h2>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum, unde. Sit vel ea ipsum atque!</p>
        </div>
        <div class="content">
            <div class="imgBx">
                <img decoding="async" src="Images/about-men.png" alt="Men">
            </div>
            <div class="contBx">
                <h3>About Me</h3>
                <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ut recusandae, praesentium repudiandae sint ab quo odio est obcaecati sed eos aliquid aliquam possimus doloribus, fugit voluptatibus porro iusto, nemo natus nihil nostrum modi. Nobis reprehenderit sint dolore</br> </br>maiores, illum voluptatum cumque amet inventore, repudiandae optio magni maxime eveniet repellendus tenetur laudantium iure? Pariatur magni laborum corrupti eum at eos tempore omnis vero ratione minus earum id eligendi, rem architecto enim, quo minima voluptate, fuga saepe necessitatibus? Aspernatur sed voluptate debitis.</p>
                <a href="#" class="btn">Learn More</a>
            </div>
        </div>
    </section>
    <section id="services">
        <div class="secText">
            <h2>Who I am</h2>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum, unde. Sit vel ea ipsum atque!</p>
        </div>
        <div class="content">
            <div class="serviceBx">
                <img decoding="async" src="Images/icon1.png" alt="Services">
                <h3>Web Design</h3>
            </div>
            <div class="serviceBx">
                <img decoding="async" src="Images/icon2.png" alt="Services">
                <h3>Web Development</h3>
            </div>
            <div class="serviceBx">
                <img decoding="async" src="Images/icon3.png" alt="Services">
                <h3>WordPress</h3>
            </div>
            <div class="serviceBx">
                <img decoding="async" src="Images/icon4.png" alt="Services">
                <h3>Conetnt Writing</h3>
            </div>
        </div>
        <div class="center">
            <a href="#" class="btn">See More</a>
        </div>
    </section>
    <section id="portfolio">
        <div class="secText">
            <h2>Recently I Have Done</h2>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum, unde. Sit vel ea ipsum atque!</p>
        </div>
        <div class="content">
            <div class="imgBx">
                <img decoding="async" src="Images/image1.png" alt="image1">
            </div>
            <div class="imgBx">
                <img decoding="async" src="Images/image2.png" alt="image2">
            </div>
            <div class="imgBx">
                <img decoding="async" src="Images/image3.png" alt="image3">
            </div>
            <div class="imgBx">
                <img decoding="async" src="Images/image4.png" alt="image4">
            </div>
            <div class="imgBx">
                <img decoding="async" src="Images/image5.png" alt="image5">
            </div>
            <div class="imgBx">
                <img decoding="async" src="Images/image6.png" alt="image6">
            </div>
        </div>
        <div class="center">
            <a href="#" class="btn">See More</a>
        </div>
    </section>
    <section id="contact">
        <div class="secText">
            <h2>Contact Me</h2>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum, unde. Sit vel ea ipsum atque!</p>
        </div>
        <div class="content">
            <a href="#"><ion-icon name="mail-outline"></ion-icon>dummy@gmail.com</a>
            <a href="#"><ion-icon name="call-outline"></ion-icon>+880 000 000 0000</a>
            <a href="#"><ion-icon name="logo-skype"></ion-icon>Skype</a>
            <a href="#"><ion-icon name="logo-whatsapp"></ion-icon>WhatsApp</a>
        </div>
        <div class="center">
            <p class="copyright">Copyright© 2023 | <a href="#">abduldev</a></p>
        </div>
    </section>
    <script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
    <script nomodule src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
    <script src="main.js"></script>
</body>
</html>
				
			

Styling with CSS for a Responsive Layout

Embarking on the CSS journey transforms the bare-bones HTML structure into a visually appealing, responsive portfolio website. The heart of this transformation lies in effectively utilizing media queries. These CSS tools allow you to apply different styling rules for various screen sizes, ensuring your portfolio’s adaptability across devices. The magic starts with defining breakpoints—specific widths at which your site’s layout changes—to cater to devices like smartphones, tablets, and desktops.

Incorporate CSS Grid or Flexbox to create flexible and maintainable layouts. These layout models offer a robust framework for designing complex responsive layouts with minimal effort. For instance, a CSS Grid can arrange project thumbnails in a seamless, adaptive grid that reflows content based on screen width, ensuring your work is presented in the best possible light, no matter the device.

Pay special attention to your site’s visual elements. Choose typography that’s legible across devices, employ a color scheme that reflects your personal brand, and utilize spacing to guide the user’s eye through your content. Remember, the goal is to create a cohesive, visually engaging experience that complements the quality of your work showcased in your portfolio.

Responsive design is more than just making things fit on a screen; it’s about creating a harmonious user experience that feels intuitive and effortless. Through strategic use of CSS, your portfolio website will be responsive and reflect your unique skills and creativity.

Second, Copy the CSS code below and paste the codes into your style.css file.

				
					@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap');

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
    scroll-behavior: smooth;
}
header{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 100px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(40px);
}
header .logo{
    position: relative;
    text-decoration: none;
    font-size: 2em;
    font-weight: 700;
    color: #fff;
}
.logo span{
    color: #ff0199;
}
header ul{
    position: relative;
    display: flex;
    gap: 40px;
}
header ul li{
    list-style: none;
}
header ul li a{
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    color: #fff;
    transition: 0.5s;
}
header ul li.active a,
header ul li:hover a{
    color: #ff0199;
}
/* Hero Section */
#home{
    position: relative;
    width: 100%;
    min-height: 100vh;
    background: #00003b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 100px;
}
#home .content{
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 650px;
    gap: 10px;
    z-index: 10;
}
#home .content h2{
    position: relative;
    font-size: 5em;
    color: #ff0199;
}
#home .content p{
    position: relative;
    color: #fff;
    font-size: 1.1em;
    line-height: 1.8em;
}
/* Global Button Style */
.btn{
    position: relative;
    display: inline-block;
    background: #ff0199;
    max-width: 200px;
    color: #fff;
    text-align: center;
    padding: 12px 30px;
    border-radius: 45px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-decoration: none;
    margin-top: 30px;
    border: 2px solid #ff0199;
    transition: 0.5s;
}
.btn:hover{
    background: transparent;
    color: #ff0199;
}
#home .men{
    position: absolute;
    bottom: 0;
    right: 100px;
    max-height: 80vh;
}
#home::before{
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40vw;
    height: 20vw;
    background: #ff0199;
    border-radius: 25vw 25vw 0 0;
}
/* About Section */
#about{
    position: relative;
    background: #000028;
    min-height: 100vh;
    padding: 120px 100px;
    display: flex;
    justify-content: center;
    flex-direction: column;
}
#about .secText{
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding-bottom: 80px;
}
.secText h2{
    font-size: 3em;
    color: #fff;
}
.secText p{
    max-width: 700px;
    text-align: center;
    color: #fff;
    font-size: 1.1em;
    line-height: 1.8em;
}
#about .content{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 40px;
    margin: 40px 0;
}
#about .content .imgBx img{
    border: 10px solid #ff0199;
    border-radius: 50%;
    box-shadow: 0 0 60px #ff0199;
}
.contBx h3{
    font-size: 2em;
    color: #fff;
    padding-bottom: 20px;
}
.contBx p{
    font-size: 1.1em;
    color: #fff;
    line-height: 1.8em;
}
#services,
#portfolio,
#contact{
    position: relative;
    background: #00003b;
    min-height: 100vh;
    padding: 120px 100px;
    display: flex;
    justify-content: center;
    flex-direction: column;
}
/* Service Section */
.secText{
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
#services .content{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 40px;
    margin: 40px 0;
}
#services .content .serviceBx{
    background: #000028;
    padding: 50px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    border: 2px solid #000028;
    border-radius: 10px;
    gap: 20px;
    transition: 0.5s;
}
#services .content .serviceBx:hover{
    border: 2px solid #ff0199;
}
#services .content .serviceBx img{
    max-width: 100%;
    filter: invert(1);
    opacity: 0.5;
    transition: 0.5s;
}
#services .content .serviceBx:hover img{
    opacity: 1;
}
#services .content .serviceBx h3{
    color: #ff0199;
    font-weight: 500;
}
.center{
    width: 100%;
    text-align: center;
}
/* Portfolio Section */
#portfolio{
    background: #000028;
    text-align: center;
}
#portfolio .content{
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 40px;
    margin: 40px 0;
}
#portfolio .content .imgBx{
    position: relative;
}
#portfolio .content .imgBx img{
    width: 100%;
    border-radius: 10px;
}
/* Contact Section */
#contact .content{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 40px;
    margin: 40px 0;
}
#contact .content a{
    background: #000028;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.2em;
    color: #fff;
    border-radius: 10px;
    transition: 0.5s;
}
#contact .content a:hover{
    background: #ff0199;
}
#contact .content a ion-icon{
    color: #ff0199;
    margin-right: 10px;
    font-size: 1.3em;
    transition: 0.5s;
}
#contact .content a:hover,
#contact .content a:hover ion-icon{
    color: #fff;
}
.copyright{
    position: relative;
    margin-top: 150px;
    font-size: 1.1em;
    color: #aaa;
}
.copyright a{
    text-decoration: none;
    color: #ff0199;
}
/* Responsive Code */
@media  screen and (max-width: 900px) {
    header{
        padding: 20px 50px;
    }
    #home{
        padding: 150px 50px;
        flex-direction: column;
        padding-bottom: 0;
    }
    #home .content h2{
        font-size: 4em;
    }
    .btn{
        max-width: 160px;
        padding: 12px 20px;
        font-size: 0.9em;
    }
    #home .men{
        position: absolute;
        height: 40vh;
        right: 30px;
    }
    .secText h2{
        font-size: 2em;
        text-align: center;
    }
    #about .content{
        grid-template-columns: repeat(1, 1fr);
    }
    #about .content .imgBx img{
        width: 80%;
        margin-left: 40px;
    }
    #about .secText{
        padding-bottom: 40px;
    }
    #about,
    #services,
    #portfolio,
    #contact{
        padding: 100px 50px 50px;
    }
    #services .content,
    #portfolio .content,
    #contact .content{
        grid-template-columns: repeat(2, 1fr);
    }
    /* Mobile Menu */
    .menuToggle{
        position: relative;
        width: 30px;
        height: 20px;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .menuToggle::before{
        content: '';
        position: absolute;
        width: 100%;
        height: 2px;
        background: #fff;
        transform: translateY(-10px);
        box-shadow: 0 10px #fff;
        transition: 0.5s;
    }
    .menuToggle::after{
        content: '';
        position: absolute;
        width: 100%;
        height: 2px;
        background: #fff;
        transform: translateY(10px);
        transition: 0.5s;
    }
    header.active .menuToggle::before{
        transform: translateY(0) rotate(45deg);
        box-shadow: 0 0 #fff;
    }
    header.active .menuToggle::after{
        transform: translateY(0) rotate(315deg);
    }
    header ul{
        display: none;
    }
    header.active ul{
        position: fixed;
        left: 0;
        top: 84px;
        width: 100%;
        height: calc(100vh - 84px);
        background: #000000f0;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        gap: 20px;
    }
    header.active ul a{
        font-size: 1.4em;
    }
}
@media  screen and (max-width: 700px) {
    header{
        padding: 20px 30px;
    }
    #home{
        padding: 150px 30px;
    }
    #about,
    #services,
    #portfolio,
    #contact{
        padding: 50px 30px;
    }
    #home .content h2{
        font-size: 3em;
    }
    #home::before{
        width: 60vw;
        height: 30vw;
        background: #ff0199;
        border-radius: 80vw 80vw 0 0;
    }
    #home .men{
        position: absolute;
        height: 40vh;
        right: 30px;
    }
    #services .content,
    #portfolio .content,
    #contact .content{
        grid-template-columns: repeat(1, 1fr);
    }
}
				
			

Enhancing Interactivity with JavaScript

JavaScript is the key to bringing dynamic content to your responsive portfolio website and elevating user engagement through interactive features. 

By incorporating JavaScript, you can implement dynamic elements such as a hamburger menu for mobile devices, modals for detailed project information, and smooth scroll functions for a seamless navigation experience. Crafting a responsive slider for your project showcase or a filterable gallery allows users to interact with your work engagingly. 

Additionally, leveraging JavaScript for form validation adds a layer of interaction that enhances user satisfaction by providing immediate feedback on their input. Ensuring that your JavaScript enhances the site’s functionality without compromising performance is essential. 

Efficiently written scripts contribute to a swift, responsive user experience across all devices, making your portfolio a showcase of your work and a demonstration of your skill in creating modern, interactive web experiences.

Third, Copy the JavaScript code below and paste the codes into your main.js file

				
					let list = document.querySelectorAll('.nav li');
function active(){
    list.forEach((i) => 
    i.classList.remove('active'));
    this.classList.add('active');
}
list.forEach((i) =>
i.addEventListener('click', active));

let menuToggle = document.querySelector('.menuToggle');
let header = document.querySelector('header');
menuToggle.onclick = function(){
    header.classList.toggle('active');
}
				
			

Testing and Optimizing Your Website

Ensuring your responsive portfolio website runs smoothly across different platforms and devices is paramount. Begin rigorously testing it on various devices, including smartphones, tablets, and desktops, to identify and resolve layout shifts or functionality issues. Employ browser developer tools and responsive design testing websites to simulate various screen sizes and environments. This proactive approach highlights areas for improvement and ensures your site’s layout and features perform as intended.

In addition to layout testing, assess your website’s performance metrics using tools such as Google PageSpeed Insights. This analysis reveals opportunities to enhance site speed, a critical factor in user experience and SEO rankings. Techniques such as compressing images without sacrificing quality, minifying CSS and JavaScript files to reduce their load time, and leveraging browser caching to store resource files locally on visitors’ devices can significantly improve loading times.

Accessibility testing should also be conducted to guarantee that your site is usable by everyone, including people with disabilities. Utilize accessibility-checking tools to identify and rectify any barriers preventing users from fully accessing your content.

Focusing on these optimization strategies ensures that your portfolio website offers a fast, efficient, and inclusive user experience. Regularly revisiting these testing and optimization processes as you update your site keeps performance at its peak, maintaining the professional and polished presence essential for your online portfolio.

Deploying Your Portfolio Website

Choosing the right platform for your responsive portfolio website’s deployment is crucial in making your project accessible to the world. After completing your website’s development and thorough testing, it’s time to select a hosting service that aligns with your needs.

Whether you prefer traditional web hosting providers or modern cloud-based solutions, ensure the one you choose offers robust performance and reliability. Once you’ve decided on a hosting service, upload your project files, keeping an eye on the directory structure to maintain the organization of your site. Implementing HTTPS is a non-negotiable deployment aspect, as it secures your website’s connection and protects visitors’ information. 

After your website goes live, continuous monitoring is essential. Utilize tools that track your site’s uptime and performance, allowing you to address any issues that may arise quickly. Regular updates are also vital, not only to add fresh content but also to patch any security vulnerabilities and optimize for evolving web standards. 

Deploying your portfolio marks the beginning of its journey online, setting the stage for showcasing your talents to a global audience.

Conclusion

Embarking on the journey to create a responsive portfolio website requires dedication, creativity, and a keen understanding of web technologies. By utilizing HTML, CSS, and JavaScript, you’re equipped to build a platform that effectively showcases your skills and projects. 

Emphasize regular maintenance and updates to keep your site relevant and engaging for visitors. Always look for new trends and technologies to enhance your website’s functionality and design. Embrace feedback and continuously seek to improve your site’s usability and accessibility. 

This proactive approach ensures that your portfolio serves as a dynamic representation of your work and a testament to your commitment to excellence in the digital domain. With these principles in mind, you’re on your way to creating a portfolio website that resonates with your audience and sets the foundation for your professional growth.

Share on Social Media

FAQs

A responsive portfolio website is designed to provide an optimal viewing experience across various devices, from desktop computers to mobile phones. It adjusts the layout and content dynamically based on the screen size and orientation of the device, ensuring a seamless user experience.

Responsiveness is crucial because it ensures your portfolio is accessible and visually appealing on any device. This improves user experience, increases engagement, and boosts your site’s SEO ranking. With more people accessing the web via mobile devices, having a responsive site is essential.

The primary technologies required are HTML for structuring the content, CSS for styling and layout, and JavaScript for adding interactivity. Additionally, frameworks like Bootstrap and libraries like jQuery can expedite the development process and enhance functionality.

To make a website responsive with CSS, use flexible grid layouts, flexible images, and media queries. Media queries allow you to apply different styles based on the device’s characteristics, such as width, height, or orientation, ensuring the site looks good on all screen sizes.

Media queries are a CSS feature that enables you to apply styles selectively based on the conditions of the user’s device, such as screen width, height, resolution, and orientation. They are essential for creating responsive designs that adapt to various screen sizes.

JavaScript enhances a portfolio website by adding interactive elements like image sliders, modal pop-ups, form validation, and animations. It improves user experience by making the site more dynamic and engaging.

Related Articles

1 thought on “Creating a Responsive Portfolio Website with HTML, CSS, and JavaScript”

  1. Pingback: Transparent Animated Login Form Using HTML and CSS 2024

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top