gpt-4o-2024-11-20· OpenAI
WildChat-4.8M (AI2)
Hello boleh buatkan html navbar dan future home secara cantik dengan CSS dan p
- User
Hello boleh buatkan html navbar dan future home secara cantik dengan CSS dan p
- Assistant
Hello boleh buatkan html navbar dan future home secara cantik dengan CSS dan p
Baik! Berikut adalah contoh kod HTML yang mengandungi bar navigasi (navbar) dan bahagian laman 'Home' dengan reka bentuk menggunakan CSS. Rekaan ini bersifat responsif serta kelihatan moden dan minimalis.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Future Home</title>
<style>
/* CSS untuk reset margin dan padding */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Arial', sans-serif;
}
/* Styling untuk navbar */
nav {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 20px;
background-color: #333;
color: white;
}
nav .logo {
font-size: 24px;
font-weight: bold;
letter-spacing: 2px;
}
nav ul {
list-style: none;
display: flex;
gap: 20px;
}
nav ul li {
color: white;
}
nav ul li a {
text-decoration: none;
color: white;
transition: color 0.3s ease;
}
nav ul li a:hover {
color: #00bcd4;
}
/* Bahagian Future Home */
.home-section {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(to bottom right, #1e1e1e, #5c5c5c);
color: white;
text-align: center;
padding: 20px;
}
.home-section h1 {
font-size: 3rem;
font-weight: bold;
}
.home-section p {
font-size: 1.2rem;
margin: 15px 0 30px 0;
}
button {
padding: 10px 20px;
font-size: 16px;
font-weight: bold;
color: white;
background-color: #00bcd4;
border: none;
border-radius: 25px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #1e88e5;
}
/* Responsif untuk skrin kecil */
@media (max-width: 768px) {
nav ul {
flex-direction: column;
gap: 10px;
}
.home-section h1 {
font-size: 2.5rem;
}
.home-section p {
font-size: 1rem;
}
button {
font-size: 14px;
padding: 8px 16px;
}
}
</style>
</head>
<body>
<!-- Navbar -->
<nav>
<div class="logo">YourLogo</div>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<!-- Future Home Section -->
<section class="home-section" id="home">
<div>
<h1>Welcome to the Future</h1>
<p>Discover new possibilities and reshape the future with us.</p>
<button>Explore More</button>
</div>
</section>
</body>
</html>
Navbar:
flexbox untuk memposisikan logo di kiri dan menu di kanan.Bahagian Future Home:
linear-gradient digunakan untuk memberikan latar belakang gradient yang menarik.flexbox.Responsif:
Anda boleh menyalin kod ini ke editor HTML anda dan membuka di pelayar untuk melihat reka bentuknya! 😊
Not yet included in a published release.