TUGAS 3 HTML dengan CSS
Posted: 26 Apr 2026, 22:29
tuliskan kode html berikut ke dalam 1 file bernama index.html:
Selamat Mengerjakan!!!
Code: Select all
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Website Profil</title>
<style>
/* Reset */
body {
margin: 0;
font-family: Arial, sans-serif;
background-color: #f4f6f9;
}
/* Navbar */
.navbar {
background-color: #2c3e50;
padding: 15px;
color: white;
display: flex;
justify-content: space-between;
}
.navbar a {
color: white;
text-decoration: none;
margin-left: 15px;
}
/* Container */
.container {
width: 90%;
margin: auto;
margin-top: 20px;
}
/* Card */
.card {
background: white;
padding: 20px;
margin-bottom: 20px;
border-radius: 10px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
/* Profile */
.profile {
display: flex;
align-items: center;
}
.profile img {
border-radius: 50%;
margin-right: 20px;
}
/* List */
ul {
padding-left: 20px;
}
/* Table */
table {
width: 100%;
border-collapse: collapse;
}
table, th, td {
border: 1px solid #ddd;
}
th {
background-color: #3498db;
color: white;
}
th, td {
padding: 10px;
text-align: center;
}
/* Form */
input, button {
width: 100%;
padding: 10px;
margin-top: 10px;
}
button {
background-color: #2ecc71;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #27ae60;
}
/* Footer */
.footer {
text-align: center;
padding: 15px;
background: #2c3e50;
color: white;
margin-top: 20px;
}
/* Responsive */
@media (max-width: 600px) {
.profile {
flex-direction: column;
text-align: center;
}
}
</style>
</head>
<body>
<!-- Navbar -->
<div class="navbar">
<div><b>Website Profil</b></div>
<div>
<a href="#">Home</a>
<a href="#">Profil</a>
<a href="#">Kontak</a>
</div>
</div>
<div class="container">
<!-- Profile -->
<div class="card profile">
<img src="https://via.placeholder.com/100" width="100">
<div>
<h2>Nama Pengguna</h2>
<p>Profesi / Deskripsi singkat</p>
</div>
</div>
<!-- Hobi -->
<div class="card">
<h2>Hobi</h2>
<ul>
<li>Ngoding</li>
<li>Membaca</li>
<li>Olahraga</li>
</ul>
</div>
<!-- Tabel -->
<div class="card">
<h2>Biodata</h2>
<table>
<tr>
<th>Nama</th>
<th>Umur</th>
<th>Pekerjaan</th>
</tr>
<tr>
<td>User 1</td>
<td>25</td>
<td>Pegawai</td>
</tr>
<tr>
<td>User 2</td>
<td>30</td>
<td>Programmer</td>
</tr>
</table>
</div>
<!-- Form -->
<div class="card">
<h2>Kontak</h2>
<form>
<input type="text" placeholder="Nama">
<input type="email" placeholder="Email">
<input type="password" placeholder="Password">
<button>Kirim</button>
</form>
</div>
</div>
<!-- Footer -->
<div class="footer">
© 2026 Website Profil
</div>
</body>
</html>