Course / دورة
CSSسي إس إس
Make your pages look good
اجعل صفحاتك تبدو جميلة
beginner 43 lessons 8 chapters 22 hours
Before you start / قبل أن تبدأ: HTML
0 / 43 lessons completed / دروس مكتملة
What you will be able to do / ماذا ستستطيع أن تفعل
- Select exactly the elements you mean, and know which rule wins تحدد العناصر التي تقصدها بدقة وتعرف أي قاعدة تفوز
- Lay out a page with flexbox and grid rather than by trial and error تبني تخطيط الصفحة بـflexbox وgrid بدل المحاولة والخطأ
- Make a layout work on a phone and on a wide screen تجعل التخطيط يعمل على الهاتف وعلى الشاشة العريضة
- Support a dark theme and Arabic text properly تدعم السمة الداكنة والنص العربي كما ينبغي
1 Getting startedالبداية 3
-
1
What is CSS & three ways to add it / ما هي CSS وثلاث طرق لإضافتها
HTML describes structure; CSS decides how that structure looks. You can add CSS to a page three ways — inline with the
styleattribute, inside a<style>block, or in a separate.cssfile linked with<link>— and only the last one is what real projects use.HTML تصف الهيكل، و CSS تقرر شكل ذلك الهيكل. ويمكنك إضافة CSS إلى الصفحة بثلاث طرق: مباشرة عبر سمة
style، أو داخل كتلة<style>، أو في ملف.cssمنفصل مربوط عبر<link>— والطريقة الأخيرة وحدها هي ما تستعملها المشاريع الحقيقية. -
2
Syntax: selector, property, value / الصياغة: المُحدِّد والخاصية والقيمة
Every CSS rule has the same shape: a selector says which elements it targets, and one or more declarations — each a property paired with a value — say how they should look.
لكل قاعدة CSS نفس الشكل: مُحدِّد يقول أي العناصر يستهدف، وإعلان واحد أو أكثر — كل إعلان خاصية مقترنة بقيمة — يقول كيف يجب أن تبدو.
-
3
Comments & code style / التعليقات وأسلوب الكود
CSS comments (
/* … */) let you leave notes for later or switch a rule off while testing. Steady formatting — one declaration per line, consistent indentation — is what keeps a stylesheet readable once it grows past a handful of rules.تعليقات CSS (
/* … */) تتيح لك ترك ملاحظات لاحقًا أو تعطيل قاعدة مؤقتًا أثناء التجربة. والتنسيق الثابت — إعلان واحد في كل سطر، ومسافات بادئة متسقة — هو ما يبقي ورقة التنسيق مقروءة بعد أن تكبر عن حفنة قواعد.
2 Selectors and the cascadeالمحدِّدات والتتالي 11
-
4
Element selectors / محدِّدات العناصر
The simplest selector is a bare tag name: write
pand the rule reaches every<p>on the page at once — one rule, as many elements as the page happens to have.أبسط مُحدِّد هو اسم وسم مجرّد: اكتب
pفتصل القاعدة إلى كل<p>في الصفحة دفعة واحدة — قاعدة واحدة، بعدد ما تملكه الصفحة من عناصر. -
5
Class & ID selectors / مُحدِّدات الصنف والمعرّف
Select elements by their
classoridattribute:.cardfor anything sharing a class,#headerfor the one element with that id.اختر العناصر بسمة
classأوid:.cardلكل ما يشترك في صنف واحد، و#headerللعنصر الوحيد الذي يحمل هذا المعرّف. -
6
Grouping & the universal selector / التجميع والمُحدِّد الشامل
Style several selectors at once with a comma, or reach every element on the page with
*— and know when each is the right tool.نسّق عدة مُحدِّدات دفعة واحدة بفاصلة، أو صِل إلى كل عنصر في الصفحة بـ
*— واعرف متى يكون كل منهما الأداة الصحيحة. -
7
Combinators / روابط المُحدِّدات
Combine two selectors to target elements by their position in the HTML:
A Breaches anywhere inside,A > Breaches only a direct child, andA + B/A ~ Breach siblings.اجمع بين مُحدِّدين لتستهدف العناصر حسب موقعها داخل HTML:
A Bيصل إلى أي مكان بالداخل، وA > Bيصل فقط إلى ابن مباشر، بينماA + BوA ~ Bيصلان إلى الأشقاء. -
8
Attribute selectors / مُحدِّدات السمات
Select elements by the HTML attributes they carry, and even by part of an attribute value:
[type="email"],[href^="https"],[class*="btn"].اختر العناصر حسب السمات التي تحملها في HTML، بل وحسب جزء من قيمة السمة:
[type="email"]و[href^="https"]و[class*="btn"]. -
9
Pseudo-classes / الأصناف الزائفة
Style an element by its current state — being hovered, focused, pressed or already visited — with a pseudo-class.
الصنف الزائف يتيح لك تنسيق العنصر بحسب حالته الحالية — أثناء المرور عليه، أو التركيز عليه، أو ضغطه، أو كونه رابطًا زُرته من قبل.
-
10
Structural pseudo-classes / الأصناف الزائفة البنيوية
Select an element by its position among its siblings — first, last, or a repeating pattern — instead of its tag, class or id.
اختر عنصرًا بحسب موضعه بين إخوته — الأول، أو الأخير، أو نمط متكرر — بدل الاعتماد على الوسم أو الصنف أو الـ id.
-
11
Pseudo-elements / العناصر الزائفة
Generate extra content that is not in the HTML using ::before and ::after, and style part of an element's text with ::first-line.
أضف محتوى إضافيًا غير موجود في HTML باستخدام ::before و ::after، ونسّق جزءًا من نص العنصر باستخدام ::first-line.
-
12
Modern selectors / المُحدِّدات الحديثة
Four selectors that shorten what you already know:
:not()excludes,:is()groups,:where()groups without weight, and:has()lets a parent react to its children.أربعة مُحدِّدات تختصر ما تعرفه أصلًا:
:not()يستثني، و:is()يجمّع، و:where()يجمّع بلا وزن، و:has()يجعل العنصر الأب يتفاعل مع أبنائه. -
13
Styling form states / تنسيق حالات النموذج
A form control changes as it is used — checked, disabled, focused, invalid, still empty. CSS can see every one of those states, so the form can answer the visitor without a line of JavaScript.
يتغير عنصر التحكم في النموذج أثناء استخدامه — مُعلَّم، معطّل، مركَّز عليه، غير صالح، ما زال فارغًا. وتستطيع CSS رؤية كل واحدة من هذه الحالات، فيجيب النموذج الزائر دون سطر واحد من JavaScript.
-
14
Specificity, the cascade & inheritance / الأولوية، والتتالي، والوراثة
You now have five ways to select the same element. When two rules conflict, specificity, the cascade and inheritance decide, together, which one wins.
أصبح لديك الآن خمس طرق لاختيار العنصر نفسه. وحين تتعارض قاعدتان، تقرر الأولوية والتتالي والوراثة معًا أيهما تفوز.
3 Colour and typeالألوان والخطوط 6
-
15
Colors / الألوان
Set text and background colors with names, hex,
rgb()andhsl()— pluscurrentColor,transparent, and how to check a color pair is actually readable.اضبط ألوان النص والخلفية بالأسماء و hex و
rgb()وhsl()— إضافة إلىcurrentColorوtransparent، وكيف تتحقق أن ألوانك مقروءة فعلاً. -
16
Units / وحدات القياس
Every size in CSS needs a unit.
pxis fixed, whilerem,em,%andvwall measure against something else.كل قياس في CSS يحتاج وحدة. الوحدة
pxثابتة، أماremوemو%وvwفتقيس كل واحدة منها بالنسبة إلى شيء آخر. -
17
calc(), min(), max() and clamp() / الدوال calc() و min() و max() و clamp()
Four functions that do arithmetic in CSS. They let one declaration cover every screen, so a heading can grow with the window and still refuse to become absurd at either end.
أربع دوال تُجري حسابات داخل CSS. تتيح لإعلان واحد أن يغطي كل الشاشات، فيكبر العنوان مع النافذة ويرفض أن يصبح سخيفًا عند أي من الطرفين.
-
18
Fonts / الخطوط
Choose a typeface with
font-family, then set its size, weight and style — and always give the browser a fallback.اختر نوع الخط بـ
font-family، ثم اضبط حجمه ووزنه ونمطه — وأعطِ المتصفح خطًا بديلًا دائمًا. -
19
Styling text / تنسيق النص
Align it, underline it, space it out — and give it a
line-height, which is the cheapest readability win in CSS.حاذِ النص، وضع تحته خطًا، وباعِد بين حروفه — وأعطه
line-height، فهي أرخص مكسب للقراءة في CSS كلها. -
20
Web fonts & Arabic fonts / خطوط الويب والخطوط العربية
Ship a font with your page using
@font-face— and choose one that actually contains Arabic letters, because most do not.أرسِل الخط مع صفحتك باستخدام
@font-face— واختر خطًا يحتوي فعلًا على حروف عربية، فأغلب الخطوط لا تحتويها.
4 The boxالصندوق 7
-
21
The box model / نموذج الصندوق
Every element is a rectangular box made of four layers: content, padding, border and margin. This lesson makes the difference between them unmistakable.
كل عنصر هو صندوق مستطيل مكوّن من أربع طبقات: المحتوى، والحشو، والحدود، والهامش. هذا الدرس يجعل الفرق بينها واضحًا تمامًا.
-
22
Sizing a box / تحديد حجم الصندوق
widthandheightset the size of an element's content — until padding and border push it wider.box-sizing: border-boxfixes that by counting them inward instead of adding them on top.تحددان
widthوheightحجم محتوى العنصر — إلى أن يوسّعاه الحشو والحدود. وتُصلحbox-sizing: border-boxذلك بحساب الحشو والحدود ضمن الحجم نفسه بدل إضافتهما فوقه. -
23
Borders & border-radius / الحدود و border-radius
A border needs three things to appear: a width, a style and a color. Then
border-radiusrounds its corners, all the way to a circle.تحتاج الحدود إلى ثلاثة أشياء حتى تظهر: عرض ونمط ولون. ثم تُقوّس
border-radiusزواياها، وصولًا إلى دائرة كاملة. -
24
Logical properties / الخصائص المنطقية
Write start and end instead of left and right, and one stylesheet serves an Arabic page and an English one correctly — without a second rule for either.
اكتب البداية والنهاية بدل اليسار واليمين، فيخدم ملف أنماط واحد صفحة عربية وأخرى إنجليزية بشكل صحيح — دون قاعدة ثانية لأي منهما.
-
25
Backgrounds & gradients / الخلفيات والتدرّجات اللونية
Put a picture behind an element with
background-image, control how it repeats, sits and scales, or skip the file entirely and paint alinear-gradient()instead.ضع صورة خلف عنصر باستخدام
background-image، وتحكّم بتكرارها وموضعها وحجمها، أو تجاوز الملف كليًا وارسمlinear-gradient()بدلًا منه. -
26
Aspect ratio & object-fit / نسبة الأبعاد و object-fit
Two properties that solve the oldest problem in web layout: photos arrive at sizes you did not choose.
aspect-ratioreserves a shape, andobject-fitdecides how the picture fills it.خاصيتان تحلان أقدم مشكلة في تخطيط الويب: الصور تصل بأحجام لم تخترها أنت. تحجز
aspect-ratioشكلًا، وتقررobject-fitكيف تملأ الصورة ذلك الشكل. -
27
box-shadow & text-shadow / box-shadow و text-shadow
box-shadowadds depth around a whole box;text-shadowadds it just behind the letters. A soft, low-opacity shadow almost always reads better than a hard, solid one.تضيف
box-shadowعمقًا حول الصندوق كله، بينما تضيفهtext-shadowخلف الحروف فقط. والظل الناعم منخفض الشفافية يبدو دائمًا تقريبًا أفضل من ظل حاد وصلب.
5 Layoutالتخطيط 8
-
28
The display property / خاصية display
The
displayproperty decides how an element's box behaves in the page's flow: whether it starts a new line, sits inside one, accepts a size — or disappears from the page entirely.خاصية
displayتقرر كيف يتصرف صندوق العنصر داخل تدفق الصفحة: هل يبدأ سطرًا جديدًا، أم يجلس داخل سطر، أم يقبل تحديد حجمه — أم يختفي من الصفحة تمامًا. -
29
overflow & visibility / خاصيتا overflow و visibility
What happens when content is bigger than its box, the four
overflowvalues, and whyvisibility: hiddenleaves a gap whiledisplay: nonedoes not.ماذا يحدث عندما يكون المحتوى أكبر من صندوقه، وقيم
overflowالأربع، ولماذا تتركvisibility: hiddenفجوة بينما لا تفعلdisplay: noneذلك. -
30
position & z-index / خاصيتا position و z-index
static,relative,absolute,fixedandsticky— what each one positions an element against, and howz-indexdecides which one sits on top when they overlap.staticوrelativeوabsoluteوfixedوsticky— بالنسبة لماذا يتموضع كل عنصر، وكيف تقررz-indexأيها يجلس فوق الآخر عند التداخل. -
31
float & clear / خاصيتا float و clear
Floating an image so text wraps around it, using
clearto stop the wrap, the collapsed-parent problem — and an honest look at whyfloatis no longer how pages are laid out.جعل صورة عائمة ليلتف النص حولها، واستخدام
clearلإيقاف الالتفاف، ومشكلة انهيار العنصر الأب — ونظرة صادقة إلى سبب أنfloatلم تعد الطريقة التي تُبنى بها الصفحات. -
32
Flexbox 1 — the container / Flexbox 1 — الحاوية
Turn any element into a flex container with
display: flex, then arrange its children along two axes withflex-direction,justify-content,align-items,flex-wrapandgap.حوّل أي عنصر إلى حاوية Flexbox بخاصية
display: flex، ثم رتّب عناصره الفرعية على محورين بخصائصflex-directionوjustify-contentوalign-itemsوflex-wrapوgap. -
33
Flexbox 2 — the items / Flexbox 2 — العناصر
Control one flex item at a time with
flex-grow,flex-shrink,flex-basisand theflexshorthand, override its alignment withalign-self, reorder it withorder— then build a real nav bar and a row of cards.تحكّم بعنصر Flexbox واحد في كل مرة بخصائص
flex-growوflex-shrinkوflex-basisواختصارflex، وتجاوز محاذاته بـalign-self، وأعد ترتيبه بـorder— ثم ابنِ شريط تنقّل حقيقيًا وصف بطاقات. -
34
Grid 1 — rows, columns & gap / الشبكة 1 — الصفوف والأعمدة و gap
Turn any element into a grid with
display: grid, size its columns and rows withgrid-template-columns/grid-template-rows, thefrunit andrepeat(), and space cells apart withgap.حوّل أي عنصر إلى شبكة بخاصية
display: grid، وحدد أحجام أعمدتها وصفوفها بـgrid-template-columnsوgrid-template-rowsووحدةfrودالةrepeat()، وباعد بين خلاياها بـgap. -
35
Grid 2 — areas & responsive grids / الشبكة 2 — المناطق وشبكات متجاوبة
Name whole regions with
grid-template-areas, make one item span extra cells withgrid-column/grid-row, and build a grid that reflows on its own withminmax()andauto-fit— no media query needed.سمِّ مناطق كاملة بـ
grid-template-areas، واجعل عنصرًا واحدًا يمتد عبر خلايا إضافية بـgrid-columnوgrid-row، وابنِ شبكة تعيد ترتيب نفسها تلقائيًا بـminmax()وauto-fit— دون أي استعلام وسائط.
6 Responsive and themesالاستجابة والسمات 3
-
36
Responsive design & media queries / التصميم المتجاوب واستعلامات الوسائط
Adapt your CSS to the screen it is shown on with
@media,min-widthandmax-width, and the viewport tag that makes any of it work on a phone.كيّف CSS الخاص بك مع الشاشة المعروضة عليها باستخدام
@mediaوmin-widthوmax-width، ووسم viewport الذي يجعل كل ذلك يعمل فعليًا على الجوال. -
37
CSS variables / متغيّرات CSS
Store a value once with a
--nameon:root, reuse it everywhere withvar(), and change your whole site's colors from one place instead of forty.خزّن قيمة مرة واحدة بـ
--nameعلى:root، وأعد استخدامها في كل مكان عبرvar()، وغيّر ألوان موقعك كله من مكان واحد بدل أربعين مكانًا. -
38
Dark mode / الوضع الداكن
Visitors tell their device whether they want light or dark, and the browser passes that on. With the variables from last lesson, honouring it costs one media query and a second set of values.
يخبر الزوار أجهزتهم إن كانوا يريدون الفاتح أم الداكن، وينقل المتصفح ذلك إليك. ومع المتغيّرات من الدرس الماضي، لا يكلّفك احترام ذلك إلا استعلام وسائط واحدًا ومجموعة قيم ثانية.
7 Motionالحركة 2
-
39
Transitions / الانتقالات
Make a property change smoothly instead of snapping instantly, with
transition-property,-duration,-timing-function,-delay, and the shorthand that combines them.اجعل تغيّر خاصية ما تدريجيًا بدل أن يقفز فجأة، عبر
transition-propertyو-durationو-timing-functionو-delay، والاختزال الذي يجمعها معًا. -
40
Transforms & animations / التحويلات والحركات
Move, rotate and scale an element with
transformwithout disturbing the layout around it, then build a looping animation with@keyframes.حرّك عنصرًا ودوّره وكبّره أو صغّره باستخدام
transformدون أن تُخل بالتخطيط من حوله، ثم ابنِ حركة متكررة بواسطة@keyframes.
8 Ship itالإطلاق 3
-
41
Project: style your personal site, fully responsive / مشروع: صمّم موقعك الشخصي، متجاوبًا بالكامل
Take the three-page personal site you already built and give it a real stylesheet: variables, readable type, a Flexbox or Grid layout, a media query, and a hover state.
خذ موقعك الشخصي الثلاثي الصفحات الذي بنيته بالفعل، وأعطه ملف تنسيق حقيقيًا: متغيّرات، ونصًا مقروءًا، وتخطيط Flexbox أو الشبكة، واستعلام وسائط، وحالة hover.
-
42
Finding out why it looks wrong / كيف تعرف لماذا يبدو الأمر خاطئًا
A method for the moment the page does not look how you expected: check the markup, read the computed styles, and find the rule that actually won — instead of guessing and changing things.
طريقة منهجية للحظة التي لا تبدو فيها الصفحة كما توقعت: افحص الترميز، واقرأ الأنماط المحسوبة، وابحث عن القاعدة التي فازت فعلًا — بدل التخمين وتغيير الأشياء عشوائيًا.
-
43
Putting your site online / نشر موقعك على الإنترنت
The last step: a folder on your computer becomes an address anyone can open. What a host actually does, how to get the files there, and the handful of things to check once it is live.
الخطوة الأخيرة: مجلد على حاسوبك يصبح عنوانًا يستطيع أي أحد فتحه. ما الذي تفعله الاستضافة فعلًا، وكيف تُوصل الملفات إلى هناك، والأمور القليلة التي تتفقّدها بعد أن يصبح الموقع حيًّا.