Indexhtml
Indexhtml
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<nav>
<ul>
<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>
<section id="home">
<div class="container">
</div>
</section>
<section id="about">
<div class="container">
<h2>About Me</h2>
<p>I'm passionate about creating websites that are not only functional but also visually
appealing. With experience in both front-end and back-end development, I enjoy bringing ideas to
life on the web.</p>
</div>
</section>
<section id="portfolio">
<div class="container">
<h2>My Work</h2>
<div class="projects">
<div class="project">
<h3>Project 1</h3>
<p>Web design for a local business. HTML, CSS, and JavaScript used.</p>
</div>
<div class="project">
<h3>Project 2</h3>
<p>i am a full stack developer.Responsive website built with React.js and Node.js.</p>
</div>
</div>
</div>
</section>
<section id="contact">
<div class="container">
<h2>Contact Me</h2>
<form id="contactForm" onsubmit="handleSubmit(event)">
</form>
</div>
</section>
<footer>
<div class="container">
</div>
</footer>
<script src="script.js"></script>
</body>
</html>
CSS
*{
margin: 0;
padding: 0;
box-sizing: border-box;
/* Basic styles */
body {
background-color: #f4f4f4;
color: #333;
nav {
background-color: #333;
padding: 1em;
position: sticky;
top: 0;
z-index: 1000;
nav ul {
list-style: none;
display: flex;
justify-content: center;
nav ul li {
margin: 0 1em;
nav ul li a {
color: white;
text-decoration: none;
font-size: 1.2em;
section {
padding: 4em 0;
.container {
width: 80%;
margin: 0 auto;
text-align: center;
#home {
background-color: #2b2b2b;
color: white;
padding: 6em 0;
#home h1 {
font-size: 3em;
margin-bottom: 0.5em;
#home p {
font-size: 1.5em;
margin-bottom: 1em;
button {
background-color: #ff6347;
color: white;
border: none;
cursor: pointer;
font-size: 1.1em;
border-radius: 5px;
button:hover {
background-color: #ff4500;
#about {
background-color: white;
.profile-img {
width: 150px;
height: 150px;
border-radius: 50%;
margin: 1em 0;
#portfolio {
background-color: #f9f9f9;
}
.projects {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
.project {
width: 45%;
margin-bottom: 2em;
.project img {
width: 100%;
border-radius: 8px;
.project h3 {
margin-top: 1em;
#contact {
background-color: white;
form {
max-width: 600px;
margin: 0 auto;
text-align: left;
}
form label {
display: block;
margin-bottom: 0.5em;
form input,
form textarea {
width: 100%;
padding: 1em;
margin-bottom: 1em;
border-radius: 5px;
form button {
background-color: #ff6347;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
form button:hover {
background-color: #ff4500;
footer {
background-color: #333;
color: white;
padding: 1em 0;
text-align: center;
JS
function scrollToSection(sectionId) {
window.scrollTo({
top: section.offsetTop,
behavior: "smooth"
});
function handleSubmit(event) {
event.preventDefault();
// Simulate sending a message (you'd replace this with actual form submission logic)
setTimeout(() => {
form.reset();
successMessage.style.display = 'block';
setTimeout(() => {
successMessage.style.display = 'none';
}, 3000);
}, 1000);
}