Tugas Praktek Front-End
Struktur Proyek
portfolio-website/
│
├── index.html
├── styles.css
└── script.js
```
1. HTML (index.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Portfolio</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About Me</a></li>
<li><a href="#projects">Projects</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section id="home">
<h1>Welcome to My Portfolio</h1>
<p>This is a brief introduction about myself.</p>
</section>
<section id="about">
<h2>About Me</h2>
<p>Here is some information about my background, education, and skills.</p>
</section>
<section id="projects">
<h2>Projects</h2>
<div class="project">
<h3>Project 1</h3>
<p>Description of project 1.</p>
</div>
<div class="project">
<h3>Project 2</h3>
<p>Description of project 2.</p>
</div>
<!-- Add more projects as needed -->
</section>
<section id="contact">
<h2>Contact</h2>
<form id="contact-form">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea>
<button type="submit">Send</button>
</form>
</section>
</main>
<footer>
<p>© 2024 My Portfolio</p>
</footer>
<script src="script.js"></script>
</body>
</html>
```
2. CSS (styles.css)
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
}
header {
background: #333;
color: white;
padding: 10px 0;
}
nav ul {
list-style: none;
display: flex;
justify-content: center;
margin: 0;
padding: 0;
}
nav ul li {
margin: 0 15px;
}
nav ul li a {
color: white;
text-decoration: none;
}
main {
padding: 20px;
}
section {
margin: 20px 0;
}
footer {
background: #333;
color: white;
text-align: center;
padding: 10px 0;
position: fixed;
bottom: 0;
width: 100%;
}
#contact-form {
display: flex;
flex-direction: column;
}
#contact-form label {
margin: 10px 0 5px;
}
#contact-form input,
#contact-form textarea {
padding: 10px;
margin-bottom: 10px;
}
#contact-form button {
padding: 10px;
background-color: #333;
color: white;
border: none;
cursor: pointer;
}
```
3. JavaScript (script.js)
document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('contact-form');
form.addEventListener('submit', (event) => {
event.preventDefault();
alert('Message sent! Thank you for contacting me.');
form.reset();
});
});
Cara Menjalankan Proyek
1. Buat Folder Proyek:
Buat folder baru di komputer dengan nama `portfolio-website`.
2. Tambahkan File:
Buat tiga file dalam folder tersebut: `index.html`, `styles.css`, dan `script.js`.
3. Salin Kode:
Salin kode yang diberikan di atas ke dalam file yang sesuai (`index.html`, `styles.css`, dan `script.js`).
4. Buka di Browser:
Buka file
`index.html` di browser seharusnya melihat halaman portofolio
sederhana yang mencakup bagian beranda, tentang saya, proyek, dan kontak.
Sumber Tugas : https://onlinelearning.uhamka.ac.id
Komentar
Posting Komentar