Here is the complete HTML, CSS, and JavaScript code for your "John Smith Dev" portfolio website, incorporating a dark blue and white color scheme and the requested pages (Home, About, Portfolio, Contact). This output is immediately actionable and ready for deployment.
The generated code is organized into three core files:
index.html: The main structure and content of your website.style.css: All the styling rules, including colors, fonts, and layout.script.js: JavaScript for interactive elements like smooth scrolling and active navigation links.To use this code:
JohnSmithDevPortfolio).index.html, style.css, and script.js.index.html in your web browser to see your new website.index.html (Website Structure)This file defines the content and layout of your "John Smith Dev" portfolio.
/* Basic Reset & Global Styles */
:root {
--primary-dark-blue: #1A237E; /* Deep Dark Blue */
--secondary-dark-blue: #283593; /* Slightly lighter dark blue for accents */
--accent-blue: #3F51B5; /* A more vibrant blue for highlights */
--white: #FFFFFF;
--light-grey: #E0E0E0;
--text-color: #CFD8DC; /* Light grey for main text on dark background */
--heading-color: var(--white);
--border-color: rgba(255, 255, 255, 0.1);
--font-primary: 'Roboto', sans-serif;
--font-secondary: 'Montserrat', sans-serif;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
scroll-behavior: smooth;
}
body {
font-family: var(--font-primary);
line-height: 1.6;
color: var(--text-color);
background-color: var(--primary-dark-blue);
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
a {
color: var(--accent-blue);
text-decoration: none;
transition: color 0.3s ease;
}
a:hover {
color: var(--white);
}
ul {
list-style: none;
}
h1, h2, h3 {
font-family: var(--font-secondary);
color: var(--heading-color);
margin-bottom: 1rem;
line-height: 1.2;
}
h2 {
font-size: 2.5rem;
text-align: center;
margin-bottom: 2.5rem;
position: relative;
}
h2::after {
content: '';
position: absolute;
left: 50%;
bottom: -10px;
transform: translateX(-50%);
width: 60px;
height: 3px;
background-color: var(--accent-blue);
border-radius: 2px;
}
p {
margin-bottom: 1rem;
}
/* Buttons */
.btn {
display: inline-block;
padding: 12px 25px;
border-radius: 5px;
font-weight: 600;
text-transform: uppercase;
transition: background-color 0.3s ease, color 0.3s ease;
border: none;
cursor: pointer;
font-family: var(--font-secondary);
}
.primary-btn {
background-color: var(--accent-blue);
color: var(--white);
}
.primary-btn:hover {
background-color: var(--secondary-dark-blue);
color: var(--white);
}
.secondary-btn {
background-color: transparent;
color: var(--accent-blue);
border: 2px solid var(--accent-blue);
padding: 10px 23px;
}
.secondary-btn:hover {
background-color: var(--accent-blue);
color: var(--white);
}
/* Header */
.main-header {
background-color: var(--secondary-dark-blue);
padding: 1.5rem 0;
border-bottom: 1px solid var(--border-color);
position: sticky;
top: 0;
z-index: 1000;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.main-header .container {
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 1.8rem;
font-weight: 700;
}
.logo a {
color: var(--white);
text-decoration: none;
}
.logo a:hover {
color: var(--light-grey);
}
.main-nav ul {
display: flex;
}
.main-nav li {
margin-left: 30px;
}
.main-nav a {
color: var(--light-grey);
font-weight: 500;
font-size: 1.1rem;
padding: 5px 0;
position: relative;
}
.main-nav a::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 0;
height: 2px;
background-color: var(--accent-blue);
transition: width 0.3s ease;
}
.main-nav a:hover::after,
.main-nav a.active::after {
width: 100%;
}
.main-nav a:hover,
.main-nav a.active {
color: var(--white);
}
/* Hero Section */
.hero-section {
background: linear-gradient(rgba(26, 35, 126, 0.8), rgba(26, 35, 126, 0.8)), url('https://via.placeholder.com/1920x1080?text=Hero+Background') no-repeat center center/cover;
color: var(--white);
text-align: center;
padding: 100px 0;
display: flex;
align-items: center;
min-height: 80vh; /* Make hero section take up most of the viewport height */
}
.hero-content {
max-width: 800px;
margin: 0 auto;
}
.hero-content h2 {
font-size: 4rem;
margin-bottom: 1rem;
line-height: 1;
color: var(--white); /* Override general h2 color */
}
.hero-content h2::after {
display: none; /* Remove underline from hero H2 */
}
.hero-content p {
font-size: 1.5rem;
margin-bottom: 2.5rem;
max-width: 600px;
margin-left: auto;
margin-right: auto;
}
/* Content Sections */
.content-section {
padding: 80px 0;
background-color: var(--primary-dark-blue);
border-bottom: 1px solid var(--border-color);
}
.content-section:nth-of-type(even) {
background-color: var(--secondary-dark-blue);
}
.section-intro {
text-align: center;
font-size: 1.2rem;
max-width: 700px;
margin: 0 auto 3rem auto;
}
/* About Section */
.about-content {
display: flex;
flex-wrap: wrap;
gap: 30px;
align-items: flex-start;
justify-content: center;
}
.profile-pic {
width: 200px;
height: 200px;
border-radius: 50%;
object-fit: cover;
border: 5px solid var(--accent-blue);
flex-shrink: 0;
}
.about-content p {
flex: 1;
min-width: 300px;
max-width: 700px;
text-align: justify;
}
/* Portfolio Section */
.portfolio-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
}
.portfolio-item {
background-color: var(--primary-dark-blue);
border: 1px solid var(--border-color);
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
transition: transform 0.3s ease, box-shadow 0.3s ease;
display: flex;
flex-direction: column;
}
.portfolio-item:hover {
transform: translateY(-5px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}
.portfolio-item img {
width: 100%;
height: 250px;
object-fit: cover;
border-bottom: 1px solid var(--border-color);
}
.portfolio-item h3 {
font-size: 1.8rem;
margin: 1.5rem 1.5rem 0.5rem 1.5rem;
color: var(--white);
}
.portfolio-item p {
padding: 0 1.5rem;
margin-bottom: 1.5rem;
flex-grow: 1; /* Allows text to take up available space */
}
.portfolio-item .btn {
margin: 0 1.5rem 1.5rem 1.5rem;
align-self: flex-start; /* Aligns button to the left */
}
/* Contact Section */
.contact-form {
max-width: 700px;
margin: 0 auto 3rem auto;
background-color: var(--primary-dark-blue);
padding: 30px;
border-radius: 8px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: var(--white);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
width: 100%;
padding: 12px;
border: 1px solid var(--border-color);
border-radius: 5px;
background-color: var(--secondary-dark-blue);
color: var(--white);
font-size: 1rem;
outline: none;
transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group textarea:focus {
border-color: var(--accent-blue);
box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.3);
}
.form-group textarea {
resize: vertical;
min-height: 120px;
}
.contact-info {
text-align: center;
margin-top: 3rem;
}
.contact-info ul {
display: flex;
justify-content: center;
gap: 25px;
margin-top: 15px;
flex-wrap: wrap;
}
.contact-info a {
font-size: 1.1rem;
font-weight: 500;
color: var(--accent-blue);
}
/* Footer */
.main-footer {
background-color: var(--secondary-dark-blue);
color: var(--light-grey);
text-align: center;
padding: 40px 0;
border-top: 1px solid var(--border-color);
}
.main-footer p {
margin-bottom: 0.5rem;
}
/* Responsive Design */
@media (max-width: 768px) {
.main-header .container {
flex-direction: column;
text-align: center;
}
.main-nav ul {
margin-top: 15px;
flex-wrap: wrap;
justify-content: center;
}
.main-nav li {
margin: 0 15px 10px 15px;
}
.hero-content h2 {
font-size: 3rem;
}
.hero-content p {
font-size: 1.2rem;
}
h2 {
font-size: 2rem;
}
.about-content {
flex-direction: column;
align-items: center;
}
.about-content p {
text-align: left;
}
.portfolio-grid {
grid-template-columns: 1fr;
}
.contact-info ul {
flex-direction: column;
gap: 10px;
}
}
@media (max-width: 480px) {
.hero-content h2 {
font-size: 2.5rem;
}
.hero-content p {
font-size: 1rem;
}
.main-nav li {
margin: 0 10px 10px 10px;
}
}
Actionable Details & Recommendations for script.js:
* Mobile Navigation Toggle: Add a hamburger menu for smaller screens.
* Dynamic Content Loading: If you have many portfolio items, consider loading them dynamically.
* Animations: Implement scroll-reveal animations for sections as they enter the viewport using libraries like AOS (Animate On Scroll).
While a direct live preview cannot be embedded in this text output, imagine opening index.html in your browser. You would see:
This setup provides a solid, professional foundation for your online portfolio. Good luck with your development!
App: websitebuilder
Focus: Deploy
The "Website Code Generator" workflow has successfully completed its generation phase, and we are now moving to the deployment phase. Below you will find the complete, production-ready HTML, CSS, and JavaScript code for your portfolio website, "John Smith Dev," adhering to a dark blue and white color scheme.
This output is designed to be immediately actionable, allowing you to launch your website quickly.
Here is the complete code for your website. You should save these into three separate files: index.html, style.css, and script.js within the same directory.
index.html (Main HTML File)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>John Smith Dev - Portfolio</title>
<meta name="description" content="Official portfolio website of John Smith Dev, showcasing projects, skills, and contact information.">
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
<!-- Favicon (optional) -->
<!-- <link rel="icon" href="favicon.ico" type="image/x-icon"> -->
</head>
<body>
<header class="main-header">
<div class="container">
<h1 class="logo"><a href="#home">John Smith Dev</a></h1>
<nav class="main-nav">
<button class="menu-toggle" aria-label="Toggle navigation">
<span></span>
<span></span>
<span></span>
</button>
<ul class="nav-links">
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</div>
</header>
<main>
<section id="home" class="hero-section">
<div class="container">
<div class="hero-content">
<h2>Hello, I'm John Smith.</h2>
<p class="tagline">A passionate web developer building modern and responsive web applications.</p>
<a href="#portfolio" class="btn primary-btn">View My Work</a>
<a href="#contact" class="btn secondary-btn">Get In Touch</a>
</div>
</div>
</section>
<section id="about" class="about-section section-padding">
<div class="container">
<h2>About Me</h2>
<div class="about-content">
<div class="about-text">
<p>Welcome to my corner of the internet! I'm John Smith, a dedicated developer with a strong focus on creating intuitive and high-performing web experiences. My journey in development started with a curiosity for how things work online, and it quickly evolved into a passion for bringing ideas to life through code.</p>
<p>I specialize in front-end development, with a solid understanding of HTML, CSS, and JavaScript, and I'm always eager to learn new technologies and frameworks. I believe in clean code, user-centric design, and continuous improvement. Let's build something amazing together!</p>
</div>
<div class="skills-list">
<h3>My Skills</h3>
<ul>
<li>HTML5 & CSS3</li>
<li>JavaScript (ES6+)</li>
<li>React / Vue.js (Placeholder)</li>
<li>Responsive Design</li>
<li>Git & GitHub</li>
<li>UI/UX Principles</li>
</ul>
</div>
</div>
</div>
</section>
<section id="portfolio" class="portfolio-section section-padding">
<div class="container">
<h2>My Portfolio</h2>
<p class="section-description">A selection of my recent projects demonstrating my skills and problem-solving abilities.</p>
<div class="portfolio-grid">
<div class="portfolio-item">
<img src="https://via.placeholder.com/400x250/3465a4/ffffff?text=Project+1" alt="Project 1 Thumbnail">
<h3>Project Title One</h3>
<p>A brief description of Project One, highlighting key technologies used and its purpose.</p>
<a href="#" class="btn tertiary-btn" target="_blank">View Project</a>
</div>
<div class="portfolio-item">
<img src="https://via.placeholder.com/400x250/3465a4/ffffff?text=Project+2" alt="Project 2 Thumbnail">
<h3>Project Title Two</h3>
<p>Description for Project Two, focusing on the challenges overcome and its impact.</p>
<a href="#" class="btn tertiary-btn" target="_blank">View Project</a>
</div>
<div class="portfolio-item">
<img src="https://via.placeholder.com/400x250/3465a4/ffffff?text=Project+3" alt="Project 3 Thumbnail">
<h3>Project Title Three</h3>
<p>Details about Project Three, including any unique features or design choices.</p>
<a href="#" class="btn tertiary-btn" target="_blank">View Project</a>
</div>
<div class="portfolio-item">
<img src="https://via.placeholder.com/400x250/3465a4/ffffff?text=Project+4" alt="Project 4 Thumbnail">
<h3>Project Title Four</h3>
<p>Summary of Project Four, explaining its functionality and my contribution.</p>
<a href="#" class="btn tertiary-btn" target="_blank">View Project</a>
</div>
</div>
</div>
</section>
<section id="contact" class="contact-section section-padding">
<div class="container">
<h2>Get In Touch</h2>
<p class="section-description">Have a project in mind or just want to say hello? Feel free to reach out!</p>
<form class="contact-form">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-group">
<label for="message">Message:</label>
<textarea id="message" name="message" rows="6" required></textarea>
</div>
<button type="submit" class="btn primary-btn">Send Message</button>
</form>
<div class="contact-info">
<p>Email: <a href="mailto:john.smith@example.com">john.smith@example.com</a></p>
<p>LinkedIn: <a href="https://linkedin.com/in/johnsmithdev" target="_blank">linkedin.com/in/johnsmithdev</a></p>
<p>GitHub: <a href="https://github.com/johnsmithdev" target="_blank">github.com/johnsmithdev</a></p>
</div>
</div>
</section>
</main>
<footer class="main-footer">
<div class="container">
<p>© 2023 John Smith Dev. All rights reserved.</p>
<div class="footer-links">
<a href="#home">Home</a>
<a href="#about">About</a>
<a href="#portfolio">Portfolio</a>
<a href="#contact">Contact</a>
</div>
</div>
</footer>
<script src="script.js"></script>
</body>
</html>
style.css (Styling File)
/* General Resets & Variables */
:root {
--color-dark-blue: #1a2b4c; /* Primary dark background */
--color-medium-blue: #3465a4; /* Accent blue for highlights/buttons */
--color-light-blue: #5b8ec2; /* Lighter accent for hover */
--color-white: #ffffff;
--color-off-white: #f0f0f0; /* Light text on dark, light background */
--color-gray-text: #cccccc; /* Subtler text on dark */
--font-heading: 'Montserrat', sans-serif;
--font-body: 'Open Sans', sans-serif;
--max-width: 1200px;
--spacing-sm: 1rem;
--spacing-md: 2rem;
--spacing-lg: 4rem;
}
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
scroll-behavior: smooth;
}
body {
font-family: var(--font-body);
line-height: 1.6;
color: var(--color-off-white);
background-color: var(--color-dark-blue);
overflow-x: hidden; /* Prevent horizontal scroll */
}
.container {
max-width: var(--max-width);
margin: 0 auto;
padding: 0 var(--spacing-md);
}
a {
color: var(--color-medium-blue);
text-decoration: none;
transition: color 0.3s ease;
}
a:hover {
color: var(--color-light-blue);
}
h1, h2, h3, h4, h5, h6 {
font-family: var(--font-heading);
margin-bottom: var(--spacing-sm);
color: var(--color-white);
}
h2 {
font-size: 2.5rem;
text-align: center;
margin-bottom: var(--spacing-lg);
position: relative;
}
h2::after {
content: '';
display: block;
width: 60px;
height: 3px;
background-color: var(--color-medium-blue);
margin: 10px auto 0;
}
p {
margin-bottom: var(--spacing-sm);
}
.section-padding {
padding: var(--spacing-lg) 0;
}
.section-description {
text-align: center;
max-width: 700px;
margin: 0 auto var(--spacing-lg);
color: var(--color-gray-text);
}
/* Buttons */
.btn {
display: inline-block;
padding: 0.8rem 1.8rem;
border-radius: 5px;
font-weight: 600;
text-align: center;
transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
border: 2px solid transparent;
cursor: pointer;
}
.primary-btn {
background-color: var(--color-medium-blue);
color: var(--color-white);
}
.primary-btn:hover {
background-color: var(--color-light-blue);
}
.secondary-btn {
background-color: transparent;
color: var(--color-medium-blue);
border-color: var(--color-medium-blue);
margin-left: var(--spacing-sm);
}
.secondary-btn:hover {
background-color: var(--color-medium-blue);
color: var(--color-white);
}
.tertiary-btn {
background-color: var(--color-dark-blue);
color: var(--color-medium-blue);
border-color: var(--color-medium-blue);
font-size: 0.9rem;
padding: 0.6rem 1.2rem;
}
.tertiary-btn:hover {
background-color: var(--color-medium-blue);
color: var(--color-white);
}
/* Header */
.main-header {
background-color: var(--color-dark-blue);
padding: var(--spacing-sm) 0;
position: sticky;
top: 0;
z-index: 1000;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.main-header .container {
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 1.8rem;
font-weight: 700;
}
.logo a {
color: var(--color-white);
text-decoration: none;
}
.nav-links {
list-style: none;
display: flex;
}
.nav-links li {
margin-left: var(--spacing-md);
}
.nav-links a {
color: var(--color-off-white);
font-weight: 600;
padding: 0.5rem 0;
position: relative;
}
.nav-links a::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 0;
height: 2px;
background-color: var(--color-medium-blue);
transition: width 0.3s ease;
}
.nav-links a:hover::after,
.nav-links a.active::after {
width: 100%;
}
.menu-toggle {
display: none;
background: none;
border: none;
cursor: pointer;
padding: 10px;
position: relative;
z-index: 1001;
}
.menu-toggle span {
display: block;
width: 25px;
height: 3px;
background-color: var(--color-white);
margin: 5px 0;
transition: all 0.3s ease;
}
/* Hero Section */
.hero-section {
background: linear-gradient(rgba(26, 43, 76, 0.8), rgba(26, 43, 76, 0.8)), url('https://via.placeholder.com/1920x1080/1a2b4c/ffffff?text=Background+Image') no-repeat center center/cover;
min-height: 80vh;
display: flex;
align-items: center;
text-align: center;
position: relative;
}
.hero-content {
max-width: 800px;
margin: 0 auto;
padding: var(--spacing-lg) 0;
}
.hero-content h2 {
font-size: 3.5rem;
margin-bottom: var(--spacing-sm);
color: var(--color-white);
}
.hero-content h2::after {
display: none; /* Remove underline for hero heading */
}
.hero-content .tagline {
font-size: 1.5rem;
margin-bottom: var(--spacing-lg);
color: var(--color-off-white);
}
/* About Section */
.about-section {
background-color: var(--color-off-white);
color: var(--color-dark-blue);
}
.about-section h2, .about-section h3 {
color: var(--color-dark-blue);
}
.about-content {
display: flex;
flex-wrap: wrap;
gap: var(--spacing-lg);
align-items: flex-start;
}
.about-text {
flex: 2;
min-width: 300px;
}
.skills-list {
flex: 1;
min-width: 200px;
background-color: var(--color-dark-blue);
padding: var(--spacing-md);
border-radius: 8px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.skills-list h3 {
margin-bottom: var(--spacing-sm);
color: var(--color-white);
}
.skills-list ul {
list-style: none;
}
.skills-list li {
padding: 0.5rem 0;
border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
color: var(--color-off-white);
}
.skills-list li:last-child {
border-bottom: none;
}
/* Portfolio Section */
.portfolio-section {
background-color: var(--color-dark-blue);
}
.portfolio-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: var(--spacing-md);
}
.portfolio-item {
background-color: var(--color-dark-blue);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
transition: transform 0.3s ease, box-shadow 0.3s ease;
display: flex;
flex-direction: column;
}
.portfolio-item:hover {
transform: translateY(-5px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}
.portfolio-item img {
width: 100%;
height: 200px; /* Fixed height for consistency */
object-fit: cover;
display: block;
}
.portfolio-item h3 {
font-size: 1.4rem;
margin: var(--spacing-sm) var(--spacing-md) 0.5rem;
}
.portfolio-item p {
font-size: 0.95rem;
color: var(--color-gray-text);
padding: 0 var(--spacing-md);
flex-grow: 1; /* Allows text to take up available space */
}
.portfolio-item .btn {
margin: var(--spacing-md);
align-self: flex-start; /* Aligns button to the left */
}
/* Contact Section */
.contact-section {
background-color: var(--color-off-white);
color: var(--color-dark-blue);
}
.contact-section h2 {
color: var(--color-dark-blue);
}
.contact-form {
max-width: 600px;
margin: 0 auto var(--spacing-lg);
padding: var(--spacing-md);
background-color: var(--color-dark-blue);
border-radius: 8px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.form-group {
margin-bottom: var(--spacing-sm);
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
color: var(--color-off-white);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
width: 100%;
padding: 0.8rem;
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 5px;
background-color: #2b3c5e; /* Slightly lighter dark blue for input fields */
color: var(--color-white);
font-family: var(--font-body);
font-size: 1rem;
transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.form-group input:focus,
.form-group textarea:focus {
outline: none;
border-color: var(--color-medium-blue);
box-shadow: 0 0 0 2px rgba(52, 101, 164, 0.3);
}
.form-group textarea {
resize: vertical;
}
.contact-form .btn {
width: auto;
margin-top: var(--spacing-sm);
}
.contact-info {
text-align: center;
margin-top: var(--spacing-md);
color: var(--color-dark-blue);
}
.contact-info a {
color: var(--color-medium-blue);
}
/* Footer */
.main-footer {
background-color: var(--color-dark-blue);
color: var(--color-gray-text);
padding: var(--spacing-md) 0;
text-align: center;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.main-footer .container {
display: flex;
flex-direction: column;
align-items: center;
gap: var(--spacing-sm);
}
.footer-links a {
color: var(--color-gray-text);
margin: 0 0.8rem;
}
.footer-links a:hover {
color: var(--color-medium-blue);
}
/* Responsive Design */
@media (max-width: 768px) {
.main-header .container {
flex-wrap: wrap;
}
.main-nav {
width: 100%;
order: 1; /* Move nav below logo on small screens */
}
.nav-links {
flex-direction: column;
width: 100%;
display: none; /* Hidden by default for mobile */
text-align: center;
background-color: var(--color-dark-blue);
padding: var(--spacing-sm) 0;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.nav-links.active {
display: flex; /* Show when active */
}
.nav-links li {
margin: 0;
padding: 0.8rem 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.nav-links li:last-child {
border-bottom: none;
}
.menu-toggle {
display: block;
}
.menu-toggle.active span:nth-child(1) {
transform: translateY(8px) rotate(45deg);
}
.menu-toggle.active span:nth-child(2) {
opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
transform: translateY(-8px) rotate(-45deg);
}
.hero-content h2 {
font-size: 2.5rem;
}
.hero-content .tagline {
font-size: 1.2rem;
}
.hero-content .btn {
margin-bottom: var(--spacing-sm);
display: block;
width: 80%;
margin-left: auto;
margin-right: auto;
}
.hero-content .secondary-btn {
margin-left: auto; /* Override default margin */
}
.about-content {
flex-direction: column;
gap: var(--spacing-md);
}
.portfolio-grid {
grid-template-columns: 1fr; /* Single column on small screens */
}
h2 {
font-size: 2rem;
margin-bottom: var(--spacing-md);
}
.section-padding {
padding: var(--spacing-md) 0;
}
.main-footer .footer-links {
flex-direction: column;
}
.main-footer .footer-links a {
margin: 0.5rem 0;
}
}
@media (max-width: 480px) {
.hero-content h2 {
font-size: 2rem;
}
.hero-content .tagline {
font-size: 1rem;
}
}
script.js (JavaScript File)
document.addEventListener('DOMContentLoaded', () => {
// Smooth scrolling for navigation links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const targetId = this.getAttribute('href');
const targetElement = document.querySelector(targetId);
if (targetElement) {
// Close mobile menu if open
const navLinks = document.querySelector('.nav-links');
const menuToggle = document.querySelector('.menu-toggle');
if (navLinks.classList.contains('active')) {
navLinks.classList.remove('active');
menuToggle.classList.remove('active');
}
// Scroll to target with offset for fixed header
const headerOffset = document.querySelector('.main-header').offsetHeight;
const elementPosition = targetElement.getBoundingClientRect().top + window.pageYOffset;
const offsetPosition = elementPosition - headerOffset - 20; // Added extra padding
window.scrollTo({
top: offsetPosition,
behavior: "smooth"
});
}
});
});
// Mobile navigation toggle
const menuToggle = document.querySelector('.menu-toggle');
const navLinks = document.querySelector('.nav-links');
if (menuToggle && navLinks) {
menuToggle.addEventListener('click', () => {
navLinks.classList.toggle('active');
menuToggle.classList.toggle('active');
});
}
// Add 'active' class to nav link on scroll
const sections = document.querySelectorAll('section');
const navLi = document.querySelectorAll('.nav-links li a');
window.addEventListener('scroll', () => {
let current = '';
sections.forEach(section => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
// Adjust offset to account for fixed header
const headerHeight = document.querySelector('.main-header').offsetHeight;
if (pageYOffset >= sectionTop - headerHeight - 50) { // -50 for a little buffer
current = section.getAttribute('id');
}
});
navLi.forEach(a => {
a.classList.remove('active');
if (a.getAttribute('href').includes(current)) {
a.classList.add('active');
}
});
});
// Handle contact form submission (client-side only for now)
const contactForm = document.querySelector('.contact-form');
if (contactForm) {
contactForm.addEventListener('submit', function(e) {
e.preventDefault();
// In a real application, you would send this data to a server.
// For now, we'll just log it and show an alert.
const formData = new FormData(this);
const formObject = {};
formData.forEach((value, key) => {
formObject[key] = value;
});
console.log('Form Submitted:', formObject);
alert('Thank you for your message! We will get back to you shortly.');
this.reset(); // Clear the form
});
}
});
While a direct live preview cannot be provided in this text-based output, you can easily view your website locally:
JohnSmithDevWebsite).index.html, style.css, and script.js inside this folder.index.html: Double-click index.html in your file explorer. It will open in your default web browser.Expected Live Preview Description:
Your website will load with a clean, modern aesthetic. The primary
\n