Shaxsiy veb-sahifa yasash uchun qisqacha html, css va js dan iborat ko’d

Shaxsiy veb-sahifa yaratish uchun quyidagi qadamlarni bajaramiz:

  1. HTML yordamida asosiy tuzilmani yaratamiz.
  2. CSS yordamida sahifaga uslub beramiz.
  3. JavaScript yordamida ba’zi interaktivlik qo’shamiz (agar kerak bo’lsa).

Keling, birinchi qadamdan boshlaymiz.

HTML: Asosiy tuzilma

<!DOCTYPE html>
<html lang="uz">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mening Shaxsiy Veb-sahifam</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Salom, men [Ismingiz]</h1>
<nav>
<ul>
<li><a href="#about">Men Haqimda</a></li>
<li><a href="#projects">Loyihalarim</a></li>
<li><a href="#contact">Aloqa</a></li>
</ul>
</nav>
</header>
<section id="about">
<h2>Men Haqimda</h2>
<p>Bu yerda o'zingiz haqingizda qisqacha ma'lumot berishingiz mumkin.</p>
</section>
<section id="projects">
<h2>Loyihalarim</h2>
<p>Bu yerda sizning loyihalaringiz haqida ma'lumot berishingiz mumkin.</p>
</section>
<section id="contact">
<h2>Aloqa</h2>
<p>Bu yerda aloqaga chiqish uchun ma'lumotlarni ko'rsatishingiz mumkin.</p>
</section>
<footer>
<p>&copy; 2024 [Ismingiz]. Barcha huquqlar himoyalangan.</p>
</footer>
</body>
</html>

CSS: Uslub qo’shish

styles.css faylida sahifaga uslub qo’shamiz.

body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 0;
padding: 0;
}

header {
background: #333;
color: #fff;
padding: 1rem 0;
text-align: center;
}

nav ul {
list-style: none;
padding: 0;
}

nav ul li {
display: inline;
margin: 0 10px;
}

nav ul li a {
color: #fff;
text-decoration: none;
}

section {
padding: 2rem 0;
text-align: center;
}

footer {
background: #333;
color: #fff;
text-align: center;
padding: 1rem 0;
position: absolute;
width: 100%;
bottom: 0;
}

JavaScript: Interaktivlik (ixtiyoriy)

Agar interaktivlik qo’shmoqchi bo’lsangiz, masalan, aloqa formasi uchun, script.js faylini yaratishingiz mumkin.

document.addEventListener("DOMContentLoaded", function() {
const contactForm = document.querySelector('#contactForm');

contactForm.addEventListener('submit', function(event) {
event.preventDefault();
alert('Sizning xabaringiz yuborildi!');
});
});

HTML faylida contactForm identifikatorli formani qo’shish kerak:

<section id="contact">
<h2>Aloqa</h2>
<form id="contactForm">
<label for="name">Ism:</label>
<input type="text" id="name" name="name" required>
<br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<br>
<label for="message">Xabar:</label>
<textarea id="message" name="message" required></textarea>
<br>
<button type="submit">Yuborish</button>
</form>
</section>
<script src="script.js"></script>

Shu bilan sizning shaxsiy veb-sahifangiz tayyor. Fayllarni o’z kompyuteringizda saqlab, brauzerda ochib ko’rishingiz mumkin.


Oxirgi Ishlarimiz

Oxirgi Ishlarimiz


Blog

Blog


08
Iyun 2024

Google Search Console-ni saytga qanday ulanadi?

Google Search Console-ni saytga qanday ulanadi? Google Search Console-ni saytingizga ulash uchun quyidagi qadamlarni bajaring: 1. Google Search Console Hisobini […]

08
Iyun 2024

Google Analytics-ni saytga qanday ulanadi?

Google Analytics-ni saytga qanday ulanadi? Google Analytics-ni saytingizga ulash uchun quyidagi qadamlarni bajaring: 1. Google Analytics Hisobini Yaratish Google Analytics […]