في هذا المقال صممنا صفحة هبوط احترافية متجاوبة باستخدام HTML و CSS و JavaScript.
-
ملف HTML (
index.html) يحتوي على:- رأس الموقع مع قائمة تنقل قابلة للطي.
- قسم ترحيبي (Hero).
- أقسام "من نحن" و"خدماتنا".
- نموذج "اتصل بنا".
- تذييل الموقع.
-
ملف CSS (
style.css) لتنسيق الموقع بالكامل بمظهر أنيق ومتجاوب مع جميع الأجهزة. -
ملف JavaScript (
script.js) للتحكم في إظهار/إخفاء القائمة على الشاشات الصغيرة.
طريقة ربط الملفات داخل مجلد واحد:
افتح مجلد المشروع وضع فيه 3 ملفات:
index.html— الملف الرئيسي.style.css— ملف التنسيق.script.js— ملف البرمجة.
وتأكد أن روابط الربط داخل HTML مثل:
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
ملاحظة:
- يمكنك إضافة صورة للقسم الترحيبي بوضع صورة باسم
hero.jpgفي نفس المجلد.
ملف جافاسكريبت لصفحة الهبوط
function toggleMenu() {
const links = document.getElementById("navLinks");
if (links.style.display === "flex") {
links.style.display = "none";
} else {
links.style.display = "flex";
}
}التعليمات:
أحفظ هذا الملف باسم script.js داخل مجلد المشروع.
محتوى ملف index.html الكامل لصفحة الهبوط الاحترافية والمتجاوبة:
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>صفحة هبوط احترافية</title>
<link rel="stylesheet" href="style.css" />
<link href="https://fonts.googleapis.com/css2?family=Cairo&display=swap" rel="stylesheet" />
</head>
<body>
<header class="header">
<div class="container clearfix">
<div class="logo">شركتنا</div>
<nav class="nav">
<span class="menu-icon" onclick="toggleMenu()">☰</span>
<ul class="nav-links" id="navLinks">
<li><a href="#hero">الرئيسية</a></li>
<li><a href="#about">من نحن</a></li>
<li><a href="#services">الخدمات</a></li>
<li><a href="#contact">اتصل بنا</a></li>
</ul>
</nav>
</div>
</header>
<section class="hero" id="hero">
<div class="container">
<h1>مرحبا بكم في موقعنا</h1>
<p>نحن نقدم أفضل الحلول لتطوير أعمالك</p>
<a href="#contact" class="btn">تواصل معنا</a>
</div>
</section>
<section class="section" id="about">
<div class="container">
<h2>من نحن</h2>
<p>نحن فريق متخصص في تصميم وتطوير المواقع الإلكترونية وتقديم حلول رقمية متكاملة.</p>
</div>
</section>
<section class="section" id="services">
<div class="container">
<h2>الخدمات</h2>
<p>نقدم خدمات تصميم المواقع، تطوير التطبيقات، التسويق الإلكتروني، والمزيد.</p>
</div>
</section>
<section class="section contact" id="contact">
<div class="container">
<h2>اتصل بنا</h2>
<form>
<input type="text" placeholder="الاسم" required />
<input type="email" placeholder="البريد الإلكتروني" required />
<textarea placeholder="رسالتك" rows="5" required></textarea>
<button type="submit">إرسال</button>
</form>
</div>
</section>
<footer class="footer">
<p>جميع الحقوق محفوظة © 2025</p>
</footer>
<script src="script.js"></script>
</body>
</html>
التعليمات:
- احفظ هذا الملف باسم
index.htmlداخل مجلد المشروع. - بجانبه، ضع الملفين الآخرين:
style.css(ملف التنسيقات)script.js(ملف الجافاسكربت)
محتوى ملف style.css الكامل لتنسيق صفحة الهبوط
/* إعداد الخط العام */
body {
font-family: 'Cairo', sans-serif;
margin: 0;
padding: 0;
line-height: 1.6;
background: #f4f4f4;
color: #333;
}
/* تنسيق الهيدر */
.header {
background: #0077b6;
color: white;
padding: 10px 0;
position: sticky;
top: 0;
z-index: 1000;
}
.container {
width: 90%;
max-width: 1200px;
margin: auto;
}
.clearfix::after {
content: "";
display: table;
clear: both;
}
.logo {
float: right;
font-size: 24px;
font-weight: bold;
}
/* تنسيق القائمة */
.nav {
float: left;
position: relative;
}
.nav-links {
list-style: none;
display: flex;
gap: 20px;
}
.nav-links li {
display: inline;
}
.nav-links a {
color: white;
text-decoration: none;
padding: 8px 12px;
border-radius: 4px;
transition: background 0.3s;
}
.nav-links a:hover {
background: #023e8a;
}
/* أيقونة القائمة للأجهزة الصغيرة */
.menu-icon {
display: none;
font-size: 28px;
cursor: pointer;
color: white;
}
/* قسم البطل */
.hero {
background: linear-gradient(to right, #00b4d8, #0077b6);
color: white;
padding: 80px 20px;
text-align: center;
}
.hero h1 {
font-size: 40px;
margin-bottom: 20px;
}
.hero p {
font-size: 20px;
}
.btn {
background: white;
color: #0077b6;
padding: 10px 20px;
text-decoration: none;
font-weight: bold;
border-radius: 4px;
transition: background 0.3s;
}
.btn:hover {
background: #caf0f8;
}
/* الأقسام */
.section {
padding: 60px 20px;
background: white;
margin-bottom: 10px;
}
.section h2 {
text-align: center;
margin-bottom: 20px;
}
/* قسم التواصل */
.contact form {
max-width: 500px;
margin: auto;
display: flex;
flex-direction: column;
gap: 15px;
}
.contact input,
.contact textarea {
padding: 10px;
font-size: 16px;
border: 1px solid #ddd;
border-radius: 4px;
}
.contact button {
background: #0077b6;
color: white;
border: none;
padding: 10px;
font-size: 18px;
border-radius: 4px;
cursor: pointer;
}
.contact button:hover {
background: #0096c7;
}
/* الفوتر */
.footer {
background: #023e8a;
color: white;
text-align: center;
padding: 20px 10px;
}
/* استجابة للجوال */
@media (max-width: 768px) {
.nav-links {
display: none;
flex-direction: column;
position: absolute;
top: 50px;
left: 0;
background: #0077b6;
width: 100%;
text-align: center;
gap: 10px;
padding: 10px 0;
}
.menu-icon {
display: block;
}
.logo {
float: none;
text-align: center;
}
.nav {
float: none;
text-align: center;
}
}
