Chapterبەش 3 · Lectureوانە 3.1
HTML Basics: Documents, Links and Tablesبنەماکانی HTML: بەڵگەنامە، بەستەرەکان و خشتەکان
A complete review of the static HTML you need before PHP: tags, elements and attributes, the structure of a document, absolute, relative and mail links, and tables with colspan and rowspan — with every slide error corrected.
پێداچوونەوەیەکی تەواو بە HTMLـی نەگۆڕدا کە پێش PHP پێویستە: ، و ، پێکهاتەی بەڵگەنامە، ڕەها، ڕێژەیی و ئیمەیڵ و لەگەڵ colspan و rowspan؛ هەموو سلایدەکانیش ڕاستکراونەتەوە.
What you will learnچی فێر دەبیت
- Explain what tags, elements and attributes are, and write them correctly.
- Write a complete HTML5 document with DOCTYPE, html, head and body.
- Choose between absolute, relative and mail links, and write relative paths with ../.
- Build tables with th and td, and merge cells with colspan and rowspan.
- Explain why table-based layouts are outdated and what replaces them.
- ڕوونی بکەیتەوە ، و چین و بە دروستی بیاننووسیت.
- بەڵگەنامەیەکی تەواوی HTML5 بنووسیت لەگەڵ DOCTYPE، html، head و body.
- لە نێوان ڕەها، ڕێژەیی و ئیمەیڵدا هەڵبژێریت و ڕێژەیی بە ../ بنووسیت.
- بە th و td دروست بکەیت و بە colspan و rowspan یەک بخەیت.
- ڕوونی بکەیتەوە بۆچی بە کۆن بووە و چی جێی دەگرێتەوە.
Why review HTML before PHP?بۆچی پێش PHP پێداچوونەوە بە HTMLـدا دەکەین؟
A understands only three languages: for the content, for the look and for behaviour in the browser. PHP is not one of them. A PHP page is a program that writes HTML on the server; the browser only ever receives that HTML. So every PHP page you build is mostly HTML, and you must be able to read and write HTML well.
تەنها لە سێ زمان تێدەگات: بۆ ناوەڕۆک، بۆ شێوە و ڕووخسار و بۆ ڕەفتار لەناو . PHP یەکێک لەوانە نییە. لاپەڕەیەکی PHP کە لەسەر HTML دەنووسێت؛ هەمیشە تەنها ئەو HTMLـە وەردەگرێت. بۆیە هەر لاپەڕەیەکی PHP کە دروستی دەکەیت زۆربەی HTMLـە و دەبێت بتوانیت HTML بە باشی بخوێنیتەوە و بنووسیت.
HTML (HyperText Markup Language) is a : you mark parts of a text with , so the browser knows what each part is: a heading, a paragraph, a link, a table. It is not a programming language: it has no conditions or loops. A plain HTML file is a : every visitor sees the same content. This lecture is a review of the static web: documents, tags, links and tables. The next lecture reviews forms.
HTML (HyperText Markup Language) : بەشەکانی دەقێک بە نیشان دەکەیت، تا بزانێت هەر بەشێک چییە: سەردێڕ، بڕگە، ، . نییە: و تێدا نییە. فایلێکی HTMLـی سادە : هەموو سەردانیکەرێک هەمان ناوەڕۆک دەبینێت. ئەم وانەیە پێداچوونەوەیەکە بە : بەڵگەنامە، ، و . وانەی داهاتوو پێداچوونەوە بە دەکات.
As the lab says, we will practise the most important HTML elements example by example. Type every example yourself, save it as an .html file, and open it in your browser.
وەک تاقیگەکە دەڵێت، گرنگترین HTML نموونە بە نموونە ڕادەهێنین. هەموو نموونەیەک خۆت بنووسە، وەک فایلێکی .html پاشەکەوتی بکە و لە بیکەرەوە.
When you move house, you write labels on the boxes: "kitchen", "books", "fragile". The label is not part of what is inside the box, but it tells the helpers what the box is and where it goes. HTML tags are labels like these: they tell the browser what each piece of content is, and the browser does not show the labels themselves.
کاتێک ماڵ دەگوازیتەوە، لەسەر سندووقەکان دەنووسیت: «چێشتخانە»، «کتێب»، «ناسک». نووسراوەکە بەشێک نییە لەوەی لەناو سندووقەکەدایە، بەڵام بە یارمەتیدەران دەڵێت سندووقەکە چییە و بۆ کوێ دەچێت. HTML وەک ئەم نووسراوانەن: بە دەڵێن هەر پارچەیەکی ناوەڕۆک چییە و خودی نووسراوەکان پیشان نادات.
Where the analogy stops workingسنووری ئەم نموونەیە
A box has one label, but an HTML element can sit inside another element, which sits inside another, like boxes inside boxes.
سندووقێک یەک نووسراوی هەیە، بەڵام HTML دەتوانێت لەناو تردا بێت، کە ئەویش لەناو یەکێکی تردایە، وەک سندووق لەناو سندووقدا.
Tags and elementsتاگەکان و توخمەکان
A is an element name inside angle brackets < >, for example <h1>. Most tags come in pairs: an opening tag <h1> and a closing tag </h1>, which has a slash / before the name. The text between them is the content. The opening tag, the content and the closing tag together make one .
ناوی لەناو کەوانەی گۆشەیی < >دا، بۆ نموونە <h1>. زۆربەی جووت جووتن: دەستپێک <h1> و کۆتایی </h1>، کە پێش ناوەکە هێمای /ی هەیە. ئەو دەقەی لە نێوانیاندایە ناوەڕۆکـە. دەستپێک، ناوەڕۆک و کۆتایی پێکەوە یەک دروست دەکەن.
The browser reads the tags as instructions and does not display them. It only shows the content, formatted the way the tags say. Try this example:
وەک فەرمان دەخوێنێتەوە و پیشانیان نادات. تەنها ناوەڕۆکەکە پیشان دەدات، بەو شێوەیەی دەڵێن. ئەم نموونەیە تاقی بکەرەوە:
<h1>Hello</h1>
<p>This is a <b>short</b> paragraph.<br>
The second line starts after the line break.</p>
<hr>
<p>The tags are hidden. Only the content is shown.</p>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<h1>Hello</h1>
<p>This is a <b>short</b> paragraph.<br>
The second line starts after the line break.</p>
<hr>
<p>The tags are hidden. Only the content is shown.</p>Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 1
<h1>makes a top-level heading.<h1>سەردێڕێکی ئاستی یەکەم دروست دەکات.- Lineدێڕی 2
<p>is a paragraph;<b>makes text bold;<br>is a line break.<p>بڕگەیەکە؛<b>دەق تۆخ دەکات؛<br>دێڕ دەشکێنێت.- Lineدێڕی 4
<hr>draws a horizontal line.<hr>هێڵێکی ئاسۆیی دەکێشێت.
Tags and elementsتاگەکان و توخمەکان
Attributesخەسڵەتەکان
An opening tag can carry extra information called . Each attribute is written as name="value" inside the opening tag, for example <a href="home.html">. Always put the value between straight quotes "…". You will use attributes all the time: href for links, colspan for tables, name and type for forms.
دەستپێک دەتوانێت زانیاریی زیادە هەڵبگرێت کە پێیان دەوترێت . هەر وەک name="value" لەناو دەستپێکدا دەنووسرێت، بۆ نموونە <a href="home.html">. هەمیشە بخە نێوان جووتە ڕاست "…". هەمیشە بەکاردەهێنیت: href بۆ ، colspan بۆ ، name و type بۆ .
Tags and elementsتاگەکان و توخمەکان
Elements without a closing tagتوخمەکانی بێ تاگی کۆتایی
A few elements have no content, so they have no closing tag. They are called void (empty) elements. The most common are <br> (line break), <hr> (horizontal line), <img> (image), <input> (form field), <meta> and <link>. You may also see them written with a slash, like <br />: this older style (used in the lecture's form example) is allowed, but not needed.
چەند ناوەڕۆکیان نییە، بۆیە کۆتاییان نییە. بە ئینگلیزی پێیان دەوترێت void (بەتاڵ). باوترینیان <br> (شکاندنی دێڕ)، <hr> (هێڵی ئاسۆیی)، <img> (وێنە)، <input> ()، <meta> و <link>ن. لەوانەیە بە هێمای /یشەوە بیانبینیت، وەک <br />: ئەم شێوازە کۆنە (کە لە نموونەی وانەکەدا بەکارهاتووە) ڕێگەپێدراوە، بەڵام پێویست نییە.
That slash comes from XHTML (first published in 2000): HTML written with the strict rules of XML, where every element is closed and every attribute is lowercase and quoted. People often used the two names as if they meant the same thing. The slash is still allowed, but today's standard is the HTML Living Standard (what people call HTML5), which does not need it.
ئەو هێمایە لە XHTMLـەوە هاتووە (یەکەم جار لە ساڵی ٢٠٠٠ بڵاو کرایەوە): کە بە یاسا توندەکانی XML نووسراوە، کە تێیدا هەموو دادەخرێت و هەموو بە پیتی بچووک و لەناو دەنووسرێت. خەڵک زۆرجار هەردوو ناوەکەیان وەک یەک شت بەکار دەهێنا. ئەو هێمایە هێشتا ڕێگەپێدراوە، بەڵام ستانداردی ئەمڕۆ HTML Living Standardـە (ئەوەی خەڵک پێی دەڵێن HTML5)، کە پێویستی پێی نییە.
Tags and elementsتاگەکان و توخمەکان
Nesting elementsیەک لەناو یەکدا
Elements can sit inside other elements. Close them in the reverse order you opened them: the element opened last is closed first.
دەتوانن لەناو تردا بن. بە پێچەوانەی ڕیزبەندیی کردنەوەیان دایانبخە: ئەو دوایین جار کرایەوە، یەکەم جار دادەخرێت.
<!-- Wrong: closed in the wrong order -->
<p><b>Important</p></b>
<!-- Right: the element opened last is closed first -->
<p><b>Important</b></p>The structure of an HTML documentپێکهاتەی بەڵگەنامەیەکی HTML
Every HTML page has the same skeleton. Here is the lecture's first document, corrected and completed:
هەموو HTML هەمان ئێسکەپەیکەری هەیە. ئەمە یەکەم بەڵگەنامەی وانەکەیە، ڕاستکراوە و تەواوکراو:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>This is index page</title>
</head>
<body>
<h1>Kurdistan Technical Institute</h1>
<h2>CS Department</h2>
<h3>Dynamic Web</h3>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>This is index page</title>
</head>
<body>
<h1>Kurdistan Technical Institute</h1>
<h2>CS Department</h2>
<h3>Dynamic Web</h3>
</body>
</html>The <title> is shown on the tab, so it does not appear in this preview.
<title> لەسەر تاب پیشان دەدرێت، بۆیە لەم پێشبینینەدا دەرناکەوێت.
Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 1
The DOCTYPE declaration: "this is a modern HTML5 page".
: «ئەمە نوێی HTML5ـە».
- Lineدێڕی 2
<html>is the root element.lang="en"says the page is in English.<html>.lang="en"دەڵێت بە ئینگلیزییە.- Lineدێڕی 4
<meta charset="UTF-8">sets the . Without it, Kurdish letters can turn into strange symbols.<meta charset="UTF-8">دیاری دەکات. بەبێ ئەم دێڕە، لەوانەیە پیتە کوردییەکان ببنە هێمای سەیر.- Lineدێڕی 5
The title appears on the browser tab, not inside the page.
ناونیشانەکە لەسەر تابی دەردەکەوێت، نەک لەناو .
- Lineدێڕی 8-10
Headings from the most important (
<h1>) to less important (<h3>).سەردێڕەکان لە گرنگترینەوە (
<h1>) بۆ کەمتر گرنگ (<h3>).
- The
<!DOCTYPE html>is not an HTML tag. It is an instruction to the web browser about which version of HTML the page is written in. In HTML5 it is simply<!DOCTYPE html>, and it tells the browser to use its modern standards mode. - The
htmlelement is the , because it contains all the other elements in the document. - Inside
html, the document is divided into a head and a body. - The contains descriptive information about the document: the title, style sheets (), scripts and other meta information such as the character set. It is not shown inside the page.
- The contains everything that we want to show up in the browser window.
-
<!DOCTYPE html>HTML نییە. ڕێنماییەکە بۆ دەربارەی ئەوەی بە کام وەشانی HTML نووسراوە. لە HTML5دا تەنها<!DOCTYPE html>ـە و بە دەڵێت standards modeـی نوێی خۆی بەکاربهێنێت. -
html، چونکە هەموو تری ناو بەڵگەنامەکە لەخۆ دەگرێت. - لەناو
htmlدا، بەڵگەنامەکە دابەش دەبێت بۆ head و body. - زانیاریی وەسفکەر دەربارەی بەڵگەنامەکە لەخۆ دەگرێت: ناونیشان، فایلەکانی شێواز ()، و زانیاریی metaی تر وەک کۆمەڵەی پیتەکان. لەناو پیشان نادرێت.
- هەموو ئەو شتانە لەخۆ دەگرێت کە دەمانەوێت لە پەنجەرەی دەربکەون.
The structure of an HTML documentپێکهاتەی بەڵگەنامەیەکی HTML
Mistakes in the lecture's examplesهەڵەکانی نموونەکانی وانەکە
<!-- HTML5: short and simple -->
<!DOCTYPE html>
<!-- HTML 4.01 Strict (old): you may meet it in old pages -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">The structure of an HTML documentپێکهاتەی بەڵگەنامەیەکی HTML
A page in Kurdishلاپەڕەتۆڕێکی کوردی
The structure of an HTML documentپێکهاتەی بەڵگەنامەیەکی HTML
Where does a script go?دەسنووس لە کوێ دادەنرێت؟
JavaScript is written inside a <script> element, and HTML allows it in the <head> and in the <body>. Many pages put it at the end of the <body>, so the browser shows the content first. In the <head>, give a script that loads from a file the defer attribute: it then runs only after the whole page has been read.
لەناو <script>دا دەنووسرێت و ڕێگەی پێدەدات هەم لە <head> و هەم لە <body>دا بێت. زۆر لاپەڕە لە کۆتایی <body>دا دایدەنێن، بۆ ئەوەی سەرەتا ناوەڕۆکەکە پیشان بدات. لە <head>دا، defer بدە بەو لە فایلێکەوە بار دەکرێت: ئەو کاتە تەنها دوای ئەوە کار دەکات کە هەموو لاپەڕەکە خوێندرایەوە.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Scripts</title>
<script src="menu.js" defer></script>
</head>
<body>
<h1>Welcome</h1>
<script>
document.querySelector("h1").textContent = "Welcome, Aram!";
</script>
</body>
</html>Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 6
A script file in the head:
deferwaits until the page has been read.فایلێکی لە
<head>دا:deferچاوەڕێ دەکات تا لاپەڕەکە دەخوێندرێتەوە.- Lineدێڕی 10-12
A script at the end of the body: the
<h1>above it already exists, so the script can change its text.لە کۆتایی
<body>دا:<h1>ـی سەرەوەی پێشتر هەیە، بۆیە دەتوانێت دەقەکەی بگۆڕێت.
Hyperlinksبەستەرەکان
A (link) takes the visitor to another page, another place or another program when they click it. It is made with the <a> element. The href attribute holds the destination, and the content between <a> and </a> is the clickable text. HTML has three kinds of hyperlinks:
کاتێک کرتەی لێدەکرێت، سەردانیکەر دەبات بۆ تر، شوێنێکی تر یان تر. بە <a> دروست دەکرێت. href شوێنی مەبەست هەڵدەگرێت و ئەو ناوەڕۆکەی لە نێوان <a> و </a>دایە دەقە کرتەپێکراوەکەیە. HTML سێ جۆر هەیە:
- : the full , with the (
https://), the and maybe a . Example:https://www.google.com. Use them to link to other websites. - : only a path, counted from the folder of the current page. Example:
home.html. Use them for pages of your own site. - : start with
mailto:and open the visitor's email program with the address filled in. Example:mailto:info@example.com.
- : تەواو، لەگەڵ (
https://)، و لەوانەیە . نموونە:https://www.google.com. بۆ بەستنەوە بە تر بەکاریان بهێنە. - : تەنها ، کە لە ئێستاوە دەژمێردرێت. نموونە:
home.html. بۆ خۆت بەکاریان بهێنە. - : بە
mailto:دەست پێدەکەن و ئیمەیڵی سەردانیکەر دەکەنەوە، ناونیشانەکەشی تێدا نووسراوە. نموونە:mailto:info@example.com.
<p>Absolute link: <a href="https://www.google.com">Google</a></p>
<p>Relative link: <a href="home.html">Home</a></p>
<p>Relative link into a folder: <a href="pages/about.html">About us</a></p>
<p>Mail link: <a href="mailto:info@example.com">Send email</a></p>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<p>Absolute link: <a href="https://www.google.com">Google</a></p>
<p>Relative link: <a href="home.html">Home</a></p>
<p>Relative link into a folder: <a href="pages/about.html">About us</a></p>
<p>Mail link: <a href="mailto:info@example.com">Send email</a></p>In this preview the relative links lead nowhere, because home.html and about.html do not exist here.
لەم پێشبینینەدا بۆ هیچ کوێ ناچن، چونکە home.html و about.html لێرە بوونیان نییە.
Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 1
Absolute: protocol + domain. It works from any page.
ڕەها: + دۆمەین. لە هەر کار دەکات.
- Lineدێڕی 2
Relative:
home.htmlin the same folder as this page.ڕێژەیی:
home.htmlلە هەمان ی ئەم .- Lineدێڕی 3
Relative: go into the
pagesfolder, then openabout.html.ڕێژەیی: بچۆ ناو
pages، پاشانabout.htmlبکەرەوە.- Lineدێڕی 4
Mail: opens the email program; nothing is sent until the visitor presses Send.
ئیمەیڵ: ئیمەیڵ دەکاتەوە؛ هیچ شتێک نانێردرێت تا سەردانیکەر خۆی Send دابگرێت.
Shows how to link to other pages of your own site with relative paths, and how to link to other websites.
نیشان دەدات چۆن بە بچیتە تری خۆت و چۆن بۆ تر دابنێیت.
Watch 53:42 to 1:03:12, the Hyperlinks chapter
لە 53:42 تا 1:03:12 سەیر بکە، بەشی .
Hyperlinksبەستەرەکان
How a relative link finds its fileبەستەرێکی ڕێژەیی چۆن فایلەکەی دەدۆزێتەوە
A relative link starts from the folder of the page you are on. Look at this small site:
لە ئەو دەست پێدەکات کە تێیدایت. سەیری ئەم بچووکە بکە:
| Written inنووسراو لە | href | Opensدەیکاتەوە |
|---|---|---|
index.html | home.html | mysite/home.html |
index.html | pages/about.html | mysite/pages/about.html |
pages/about.html | ../index.html | mysite/index.html |
pages/about.html | contact.html | mysite/pages/contact.html (same folder as about.html)mysite/pages/contact.html (هەمان about.html) |
Tablesخشتەکان
A shows data in rows and columns, like a timetable or a list of students. The table is one of the important HTML elements; you will need it in many situations, for example to show rows from a database with PHP. Four main tags create a table:
دراوە بە و پیشان دەدات، وەک وانەکان یان لیستی خوێندکاران. یەکێکە لە گرنگەکانی HTML؛ لە زۆر حاڵەتدا پێویستت پێی دەبێت، بۆ نموونە بۆ پیشاندانی بە PHP. چوار سەرەکی دروست دەکەن:
| Tag | Meaningواتا |
|---|---|
<table> … </table> | Creates the table: all its rows and columns. دروست دەکات: هەموو و . |
<tr> … </tr> | Creates one table row.یەک دروست دەکات (table row). |
<th> … </th> | Creates one table header cell: bold and centred by default.یەک دروست دەکات (table header): بە شێوەی بنەڕەتی تۆخ و لە ناوەڕاستە. |
<td> … </td> | Creates one table data cell: a normal cell.یەک دراوە دروست دەکات (table data): ئاسایی. |
Dave Gray builds an HTML5 data table step by step: rows, header and data cells, caption, thead/tbody/tfoot, rowspan and colspan, styled with CSS.
Dave Gray هەنگاو بە هەنگاو دروست دەکات: ، و ، caption، thead/tbody/tfoot، و ، پاشان بە جوانی دەکات.
Watch 2:24:53 to 2:40:42, Chapter 8: Create Tables
لە 2:24:53 تا 2:40:42 سەیر بکە، بەشی هەشتەم: Create Tables.
Tablesخشتەکان
Example one: a simple data table (Lab 1)نموونەی یەکەم: خشتەیەکی سادەی دراوە (تاقیگەی ١)
This is the lab's table code (with neutral names). It uses the old attributes border, cellpadding (space inside each cell) and cellspacing (space between the cells). Browsers still understand them:
ئەمە کۆدی تاقیگەکەیە (بە ناوی بێلایەن). کۆنەکانی border، cellpadding ( لەناو هەر ) و cellspacing ( لە نێوان ) بەکاردەهێنێت. هێشتا لێیان تێدەگەن:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Students</title>
</head>
<body>
<table border="1" cellpadding="6" cellspacing="6">
<tr>
<th>Name</th>
<th>College</th>
<th>Department</th>
</tr>
<tr>
<td>Aram</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
<tr>
<td>Shilan</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
</table>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Students</title>
</head>
<body>
<table border="1" cellpadding="6" cellspacing="6">
<tr>
<th>Name</th>
<th>College</th>
<th>Department</th>
</tr>
<tr>
<td>Aram</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
<tr>
<td>Shilan</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
</table>
</body>
</html>Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 8
border="1"draws borders;cellpaddingandcellspacingadd space inside and between cells.border="1"هێڵی دەوروبەر دەکێشێت؛cellpaddingوcellspacingلەناو و لە نێوان زیاد دەکەن.- Lineدێڕی 9-13
The first row uses
<th>: header cells.یەکەم
<th>بەکاردەهێنێت: .- Lineدێڕی 14-23
Each further
<tr>is one student, with one<td>per column.هەر
<tr>ـێکی تر یەک خوێندکارە، بە یەک<td>بۆ هەر .
Tablesخشتەکان
The same table with CSSهەمان خشتە بە CSS
border, cellpadding and cellspacing are obsolete: the HTML standard asks you to style tables with instead. Here is the same table with CSS. It looks almost the same, and the content is no longer mixed with the design:
border، cellpadding و cellspacing ن: ستانداردی HTML داوا دەکات لەبری ئەوانە بە ڕازێنیتەوە. ئەمە هەمان بە CSS. نزیکەی هەمان شێوەی هەیە و ناوەڕۆک ئیتر لەگەڵ دیزاین تێکەڵ نییە:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Students</title>
<style>
table { border: 1px solid #333; border-spacing: 6px; }
th, td { border: 1px solid #333; padding: 6px; }
</style>
</head>
<body>
<table>
<tr>
<th>Name</th>
<th>College</th>
<th>Department</th>
</tr>
<tr>
<td>Aram</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
<tr>
<td>Shilan</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
</table>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Students</title>
<style>
table { border: 1px solid #333; border-spacing: 6px; }
th, td { border: 1px solid #333; padding: 6px; }
</style>
</head>
<body>
<table>
<tr>
<th>Name</th>
<th>College</th>
<th>Department</th>
</tr>
<tr>
<td>Aram</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
<tr>
<td>Shilan</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
</table>
</body>
</html>Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 7
borderon the table andborder-spacingreplaceborderandcellspacing.borderلەسەر وborder-spacingجێگەیborderوcellspacingدەگرنەوە.- Lineدێڕی 8
paddingreplacescellpadding.paddingجێگەیcellpaddingدەگرێتەوە.
| Old attribute کۆن | CSS insteadلەبری ئەوە بە CSS |
|---|---|
border="1" | border: 1px solid #333; |
cellpadding="6" | padding: 6px; (on th, td)padding: 6px; (لەسەر th, td) |
cellspacing="6" | border-spacing: 6px; (on table)border-spacing: 6px; (لەسەر table) |
width="70%" | width: 70%; |
align="center" on a cell (td, th)align="center" لەسەر (td، th) | text-align: center; (centres the text)text-align: center; (دەقەکە دەخاتە ناوەڕاست) |
align="center" on the tablealign="center" لەسەر table | margin-inline: auto; (centres the table itself)margin-inline: auto; (خودی دەخاتە ناوەڕاست) |
height="250" | height: 250px; |
valign="top" on a cell or rowvalign="top" لەسەر یان | vertical-align: top; (on th, td)vertical-align: top; (لەسەر th, td) |
bordercolor="red" (never part of the HTML 4 standard)bordercolor="red" (هەرگیز بەشێک نەبوو لە ستانداردی HTML 4) | border-color: red; |
Two old attributes, cellspacing and cellpadding, are easy to mix up: the next screen shows them side by side. All the table styles (single borders, zebra rows, hover) are taught in Styling tables.
دوو کۆن، cellspacing و cellpadding، بە ئاسانی تێکەڵ دەکرێن: شاشەی داهاتوو لە تەنیشت یەکتر پیشانیان دەدات. هەموو شێوەکانی ڕازاندنەوەی (هێڵی تاک، ڕیزی ڕەنگاوڕەنگ، hover) لە ڕازاندنەوەی خشتەکاندا فێر دەکرێن.
In Kurdish: build a simple table with tr, th and td, then style its borders and header row with CSS.
بە کوردی: سادە بە <tr>، <th> و <td> دروست دەکات، پاشان بە چوارچێوە و سەردێڕەکەی دەڕازێنێتەوە.
Whole video: Kurdish, a simple table styled with CSS
هەموو ڤیدیۆکە، بە کوردی: سادە کە بە ڕازێنراوەتەوە.
Tablesخشتەکان
Cell spacing or cell padding?cellspacing یان cellpadding؟
Cell spacing is the empty space between the cells (and between the cells and the table's edge). Cell padding is the empty space inside each cell, between its border and its text. In CSS, spacing is border-spacing on the table, and padding is padding on th and td.
Cellspacing بۆشایی نێوان (و نێوان و لێواری ). Cellpadding بۆشایی ناو هەر ، لە نێوان چوارچێوەکەی و دەقەکەیدا. لە CSSـدا، spacing border-spacingـە لەسەر table و padding paddingـە لەسەر th و td.
What is the difference between cell spacing and cell padding? Give an example.
جیاوازیی نێوان cellspacing و cellpadding چییە؟ نموونەیەک بهێنەوە.
Show answerوەڵامەکە پیشان بدە
Cell spacing is the space between neighbouring cells; cell padding is the space between a cell's border and its content. Old HTML: <table cellspacing="10" cellpadding="4">. Today, with CSS:
Cellspacing بۆشایی نێوان ؛ cellpadding بۆشایی نێوان چوارچێوەی و ناوەڕۆکەکەیەتی. HTMLـی کۆن: <table cellspacing="10" cellpadding="4">. ئەمڕۆ بە CSS:
table { border-spacing: 10px; } /* between the cells */
th, td { padding: 4px; } /* inside each cell */border-spacing has no effect when the table uses border-collapse: collapse, because then neighbouring cells share one border.
border-spacing هیچ کارێک ناکات کاتێک border-collapse: collapse بەکار دەهێنێت، چونکە ئەو کاتە یەک چوارچێوە بەش دەکەن.
Tablesخشتەکان
Merging cells: colspan and rowspanیەکخستنی خانەکان: colspan و rowspan
Column spans are created with the attribute on a td or th element. They merge two or more columns into one wide cell. Row spans are created with the attribute. They work just like column spans, but the cell spans downward over several rows.
Column span بە لەسەر td یان th دروست دەکرێت. دوو یان زیاتر دەکاتە یەک پان. Row span بە دروست دەکرێت. هەروەک column span کار دەکات، بەڵام بەرەو خوارەوە بەسەر چەند درێژ دەبێتەوە.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Column span</title>
<style>
table, th, td { border: 2px solid #333; }
th, td { padding: 6px; }
</style>
</head>
<body>
<table>
<tr>
<th colspan="2">colspan</th>
</tr>
<tr>
<td>second row, first data</td>
<td>second row, second data</td>
</tr>
</table>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Column span</title>
<style>
table, th, td { border: 2px solid #333; }
th, td { padding: 6px; }
</style>
</head>
<body>
<table>
<tr>
<th colspan="2">colspan</th>
</tr>
<tr>
<td>second row, first data</td>
<td>second row, second data</td>
</tr>
</table>
</body>
</html>Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 14
colspan="2": this header cell covers two columns, so row 1 needs no second cell.colspan="2": ئەم دوو دادەپۆشێت، بۆیە یەکەم پێویستی بە دووەم نییە.- Lineدێڕی 16-19
Row 2 has two normal cells.
دووەم دوو ئاسایی هەیە.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Row span</title>
<style>
table, th, td { border: 2px solid #333; }
th, td { padding: 6px; }
</style>
</head>
<body>
<table>
<tr>
<th rowspan="3">Work families:</th>
<td>Work</td>
</tr>
<tr>
<td>Job</td>
</tr>
<tr>
<td>Career</td>
</tr>
</table>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Row span</title>
<style>
table, th, td { border: 2px solid #333; }
th, td { padding: 6px; }
</style>
</head>
<body>
<table>
<tr>
<th rowspan="3">Work families:</th>
<td>Work</td>
</tr>
<tr>
<td>Job</td>
</tr>
<tr>
<td>Career</td>
</tr>
</table>
</body>
</html>Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 14
rowspan="3": this cell reaches down through three rows.rowspan="3": ئەم تا سێ بەرەو خوارەوە درێژ دەبێتەوە.- Lineدێڕی 17-22
Rows 2 and 3 have only one
<td>, because the first column is already filled by the tall cell.٢ و ٣ تەنها یەک
<td>یان هەیە، چونکە یەکەم پێشتر بە بەرزەکە پڕکراوەتەوە.
Tablesخشتەکان
Table sections: caption, colgroup, thead, tbody and tfootبەشەکانی خشتە: caption، colgroup، thead، tbody و tfoot
A longer table can be split into parts that say what each group of rows is for:
درێژتر دەتوانرێت بکرێتە چەند بەشێک کە دەڵێن هەر کۆمەڵە بۆ چییە:
<caption>: the table's title, written first inside<table>.<colgroup>with<col>: describes the columns, for example their width:<col style="width: 200px">.<thead>: the header row or rows, with<th>cells.<tbody>: the data rows. A table may have several.<tfoot>: the footer rows, such as a total. It is always shown at the bottom.
<caption>: ناونیشانی ، یەکەم شت لەناو<table>دا دەنووسرێت.<colgroup>لەگەڵ<col>: وەسف دەکات، بۆ نموونە پانییان:<col style="width: 200px">.<thead>: سەرەوە، بە (<th>).<tbody>: . دەتوانێت چەندانی هەبێت.<tfoot>: خوارەوە، وەک کۆی گشتی. هەمیشە لە خوارەوە پیشان دەدرێت.
Why bother? can read the right header with each cell, a long printed table can repeat its header on every page, and CSS can style each part on its own (tfoot { font-weight: bold; }).
بۆچی؟ دەتوانن لەگەڵ هەر سەردێڕە دروستەکەی بخوێننەوە، درێژی چاپکراو دەتوانێت سەردێڕەکەی لە هەموو پەڕەیەکدا دووبارە بکاتەوە و CSS دەتوانێت هەر بەشێک بە جیا بڕازێنێتەوە (tfoot { font-weight: bold; }).
Tablesخشتەکان
A complete table, in today's orderخشتەیەکی تەواو، بە ڕیزبەندیی ئەمڕۆ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Books ordered</title>
<style>
table, th, td { border: 1px solid #333; border-collapse: collapse; }
th, td { padding: 6px; }
tfoot { font-weight: bold; }
</style>
</head>
<body>
<table>
<caption>Books ordered by Shilan</caption>
<colgroup>
<col style="width: 200px">
<col>
</colgroup>
<thead>
<tr><th>Book</th><th>Price (IQD)</th></tr>
</thead>
<tbody>
<tr><td>Web Programming</td><td>15,000</td></tr>
<tr><td>Databases</td><td>12,000</td></tr>
</tbody>
<tfoot>
<tr><td>Total</td><td>27,000</td></tr>
</tfoot>
</table>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<table>
<caption>Books ordered by Shilan</caption>
<colgroup>
<col style="width: 200px">
<col>
</colgroup>
<thead>
<tr><th>Book</th><th>Price (IQD)</th></tr>
</thead>
<tbody>
<tr><td>Web Programming</td><td>15,000</td></tr>
<tr><td>Databases</td><td>12,000</td></tr>
</tbody>
<tfoot>
<tr><td>Total</td><td>27,000</td></tr>
</tfoot>
</table>The footer row "Total" is shown at the bottom, under the data.
«Total» لە خوارەوە، لە ژێر پیشان دەدرێت.
Page layout with a table (the old way)ڕێکخستنی لاپەڕە بە خشتە (ڕێگای کۆن)
Before CSS was strong, people built the whole with one big table: a header row, a menu row, a tall main area and a footer, with empty columns on the left and right. The lecture and Lab 1 (Exercise two) show this. Here is the lab's full code, with the quotes corrected:
پێش ئەوەی CSS بەهێز بێت، خەڵک هەموو بە یەک گەورە دروست دەکرد: بۆ header، بۆ menu، ناوچەیەکی بەرزی main و footer، لەگەڵ بەتاڵ لە چەپ و ڕاست. وانەکە و تاقیگەی ١ (ڕاهێنانی دووەم) ئەمە پیشان دەدەن. ئەمە کۆدی تەواوی تاقیگەکەیە، بە ڕاستکراوە:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Table layout</title>
</head>
<body>
<table width="100%" border="1">
<tr>
<td width="15%"></td>
<td width="70%" align="center" style="background-color:#FFC">Header</td>
<td width="15%"></td>
</tr>
<tr>
<td></td>
<td align="center" style="background-color:#CCC">Menu Menu</td>
<td></td>
</tr>
<tr height="200">
<td></td>
<td style="background-color:#CCF">Main</td>
<td></td>
</tr>
<tr>
<td></td>
<td style="background-color:#CCC" align="center">Footer</td>
<td></td>
</tr>
</table>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Table layout</title>
</head>
<body>
<table width="100%" border="1">
<tr>
<td width="15%"></td>
<td width="70%" align="center" style="background-color:#FFC">Header</td>
<td width="15%"></td>
</tr>
<tr>
<td></td>
<td align="center" style="background-color:#CCC">Menu Menu</td>
<td></td>
</tr>
<tr height="200">
<td></td>
<td style="background-color:#CCF">Main</td>
<td></td>
</tr>
<tr>
<td></td>
<td style="background-color:#CCC" align="center">Footer</td>
<td></td>
</tr>
</table>
</body>
</html>Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 8
The table fills the whole width;
border="1"shows the grid.هەموو پانییەکە پڕ دەکاتەوە؛
border="1"تۆڕەکە پیشان دەدات.- Lineدێڕی 9-13
Row 1: three columns of 15%, 70% and 15%. Only the middle cell (the header) has content and a pale yellow background
#FFC.١: سێ 15%، 70% و 15%. تەنها ناوەڕاست (header) ناوەڕۆک و باکگراوندی زەردی کاڵی
#FFCـی هەیە.- Lineدێڕی 16
is an : a non-breaking space. Browsers squeeze many normal spaces into one; keeps each space, so the two words stay apart. یەکێکە لە : نەشکاوە. چەند ئاسایی دەکەنە یەک ؛ هەموو دەهێڵێتەوە، بۆیە دوو وشەکە لێک دوور دەمێننەوە.- Lineدێڕی 19-23
A tall row (
height="200") for the main content, in lavender#CCF.بەرز (
height="200") بۆ ناوەڕۆکی سەرەکی، بە ڕەنگی مۆری کاڵ#CCF.- Lineدێڕی 26
The footer, in light grey
#CCC, centred.footer، بە خۆڵەمێشیی کاڵ
#CCC، لە ناوەڕاست.
Colours like #FFC are short hexadecimal codes: #FFC means #FFFFCC (pale yellow), #CCC is light grey and #CCF is pale lavender. They go inside the style attribute, which holds CSS for one element.
ڕەنگەکانی وەک #FFC کۆدی کورتی : #FFC واتە #FFFFCC (زەردی کاڵ)، #CCC خۆڵەمێشیی کاڵە و #CCF مۆری کاڵە. دەچنە ناو style، کە CSS بۆ یەک هەڵدەگرێت.
After tables, designers used floats for page layout, which was not much easier: see Why floats are the old way.
دوای ، دیزاینەران float ـیان بۆ بەکار هێنا، کە زۆر ئاسانتر نەبوو: بڕوانە بۆچی float ڕێگا کۆنەکەیە.
Page layout with a table (the old way)ڕێکخستنی لاپەڕە بە خشتە (ڕێگای کۆن)
The modern way: header, nav, main and footerڕێگای نوێ: header، nav، main و footer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Modern layout</title>
<style>
body { margin: 0; font-family: sans-serif; }
.page { display: grid; grid-template-columns: 15% 70% 15%; }
header, nav, main, footer { grid-column: 2; padding: 8px; }
header { background: #FFC; text-align: center; }
nav { background: #CCC; text-align: center; }
main { background: #CCF; min-height: 200px; }
footer { background: #CCC; text-align: center; }
</style>
</head>
<body>
<div class="page">
<header>Header</header>
<nav><a href="#">Menu</a> <a href="#">Menu</a></nav>
<main>Main</main>
<footer>Footer</footer>
</div>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Modern layout</title>
<style>
body { margin: 0; font-family: sans-serif; }
.page { display: grid; grid-template-columns: 15% 70% 15%; }
header, nav, main, footer { grid-column: 2; padding: 8px; }
header { background: #FFC; text-align: center; }
nav { background: #CCC; text-align: center; }
main { background: #CCF; min-height: 200px; }
footer { background: #CCC; text-align: center; }
</style>
</head>
<body>
<div class="page">
<header>Header</header>
<nav><a href="#">Menu</a> <a href="#">Menu</a></nav>
<main>Main</main>
<footer>Footer</footer>
</div>
</body>
</html>Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 8
A CSS grid with three columns of 15%, 70% and 15%, like the table.
تۆڕێکی CSS بە سێ 15%، 70% و 15%، وەک .
- Lineدێڕی 9
Every part is placed in the middle column.
هەموو بەشێک لە ناوەڕاستدا دادەنرێت.
- Lineدێڕی 18-21
Each part has an element that says what it is: header, navigation menu, main content, footer.
هەر بەشێک هەیە کە دەڵێت چییە: header، لیستی گەشتکردن (menu)، ناوەڕۆکی سەرەکی، footer.
This page uses CSS grid with three columns. How a grid is drawn as a map with named areas is taught in The three-column page, rebuilt with grid.
ئەم لاپەڕەیە grid ـی CSS بە سێ بەکار دەهێنێت. چۆنیەتیی کێشانی grid وەک نەخشەیەک بە ناوچەی ناونراو لە لاپەڕەی سێ ستوونی، بە grid دووبارە دروستکراوەدا فێر دەکرێت.
Common mistakesهەڵەکانی باو
| Mistake | What happensچی ڕوودەدات | Fixچارەسەر |
|---|---|---|
Curly quotes “ ” from Word or slides خوار “ ” لە Word یان سلایدەوە | Attribute values break: links fail, colspan does nothing, colours disappear. تێکدەچن: کار ناکەن، colspan هیچ ناکات، ڕەنگەکان ون دەبن. | Type code in a code editor; use straight quotes ".کۆد لە دەستکاریکەری کۆددا بنووسە؛ ڕاست " بەکاربهێنە. |
| Writing HTML in Word or WordPadنووسینی HTML لە Word یان WordPad | A word processor saves fonts and formatting (a .docx or .rtf file), not plain text. It also turns quotes into curly quotes. فۆنت و شێوەکاری پاشەکەوت دەکات (فایلی .docx یان .rtf)، نەک دەقی سادە. هەروەها دەکات بە خوار. | Use a code editor such as VS Code or Notepad++ (editors). وەک VS Code یان Notepad++ بەکار بهێنە (دەستکاریکەرەکان). |
< a href=…> | Not a tag; shown as text. نییە؛ وەک دەق پیشان دەدرێت. | <a href=…> |
Missing or wrong closing tag (<html> instead of </html>) کۆتایی نییە یان هەڵەیە (<html> لەبری </html>) | The page may still show, but parts can end up in the wrong place.لەوانەیە هەر پیشان بدرێت، بەڵام هەندێک بەش دەچنە شوێنی نادروست. | Close every element, in reverse order.هەموو دابخە، بە ڕیزبەندیی پێچەوانە. |
href="www.site.com" | Treated as a relative path; 404.وەک ڕێژەیی دادەنرێت؛ 404. | href="https://www.site.com" |
No <meta charset="UTF-8"><meta charset="UTF-8"> نییە | Kurdish letters look broken.پیتە کوردییەکان تێکچوو دەردەکەون. | Add it as the first line in <head>.وەک یەکەم دێڕ لە <head>دا زیادی بکە. |
| Table for page layout بۆ | Hard to read on phones and screen readers.لەسەر مۆبایل و خوێندنەوەی قورسە. | Use <header>, <nav>, <main>, <footer> and CSS.<header>، <nav>، <main>، <footer> و CSS بەکاربهێنە. |
Saving as page.html.txtپاشەکەوتکردنی فایلەکە بە ناوی page.html.txt | The browser shows the code as text. کۆدەکە وەک دەق پیشان دەدات. | Show file extensions in Windows and save as .html.لە ویندۆزدا پیشان بدە و وەک .html پاشەکەوتی بکە. |
Exercisesڕاهێنانەکان
Create the table below: a header row with Name, College and Department, then two students. Use <th> for the headers and <td> for the data. Give the table borders and some space inside the cells.
ئەم خوارەوە دروست بکە: سەردێڕ بە Name، College و Department، پاشان دوو خوێندکار. <th> بۆ سەردێڕەکان و <td> بۆ دراوەکان بەکاربهێنە. هێڵی دەوروبەر و کەمێک لەناو بدە .
| Name | College | Department |
|---|---|---|
| Aram | Informatics | Network Management |
| Shilan | Informatics | Network Management |
Hintئاماژە
One <tr> per row; three cells in every row.
یەک <tr> بۆ هەر ؛ سێ لە هەموو .
Show answerوەڵامەکە پیشان بدە
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Students</title>
<style>
table { border: 1px solid #333; border-spacing: 6px; }
th, td { border: 1px solid #333; padding: 6px; }
</style>
</head>
<body>
<table>
<tr>
<th>Name</th>
<th>College</th>
<th>Department</th>
</tr>
<tr>
<td>Aram</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
<tr>
<td>Shilan</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
</table>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Students</title>
<style>
table { border: 1px solid #333; border-spacing: 6px; }
th, td { border: 1px solid #333; padding: 6px; }
</style>
</head>
<body>
<table>
<tr>
<th>Name</th>
<th>College</th>
<th>Department</th>
</tr>
<tr>
<td>Aram</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
<tr>
<td>Shilan</td>
<td>Informatics</td>
<td>Network Management</td>
</tr>
</table>
</body>
</html>Build the page layout from Exercise two: a header (pale yellow), a menu row with two "Menu" words (grey), a tall main area (lavender) and a footer (grey), all in the middle 70% of the page. First do it with a table, as in the lab. Then, as an extra step, do it with <header>, <nav>, <main> and <footer>.
ڕاهێنانی دووەم دروست بکە: header (زەردی کاڵ)، menu بە دوو وشەی «Menu» (خۆڵەمێشی)، ناوچەیەکی بەرزی main (مۆری کاڵ) و footer (خۆڵەمێشی)، هەمووی لە ٧٠%ـی ناوەڕاستی . سەرەتا بە بیکە، وەک تاقیگەکە. پاشان، وەک هەنگاوێکی زیادە، بە <header>، <nav>، <main> و <footer> بیکە.
Hintئاماژە
Four rows and three columns (15% + 70% + 15%). Only the middle cells have content. Use between the two Menu words.
چوار و سێ (15% + 70% + 15%). تەنها ناوەڕاست ناوەڕۆکیان هەیە. لە نێوان دوو وشەی Menu بەکاربهێنە.
Show answerوەڵامەکە پیشان بدە
The table version is the corrected lab code in Page layout with a table. The modern version:
وەشانی کۆدی ڕاستکراوەی تاقیگەکەیە لە ڕێکخستنی لاپەڕە بە خشتە. وەشانی نوێ:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Modern layout</title>
<style>
body { margin: 0; font-family: sans-serif; }
.page { display: grid; grid-template-columns: 15% 70% 15%; }
header, nav, main, footer { grid-column: 2; padding: 8px; }
header { background: #FFC; text-align: center; }
nav { background: #CCC; text-align: center; }
main { background: #CCF; min-height: 200px; }
footer { background: #CCC; text-align: center; }
</style>
</head>
<body>
<div class="page">
<header>Header</header>
<nav><a href="#">Menu</a> <a href="#">Menu</a></nav>
<main>Main</main>
<footer>Footer</footer>
</div>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Modern layout</title>
<style>
body { margin: 0; font-family: sans-serif; }
.page { display: grid; grid-template-columns: 15% 70% 15%; }
header, nav, main, footer { grid-column: 2; padding: 8px; }
header { background: #FFC; text-align: center; }
nav { background: #CCC; text-align: center; }
main { background: #CCF; min-height: 200px; }
footer { background: #CCC; text-align: center; }
</style>
</head>
<body>
<div class="page">
<header>Header</header>
<nav><a href="#">Menu</a> <a href="#">Menu</a></nav>
<main>Main</main>
<footer>Footer</footer>
</div>
</body>
</html>Make two pages. index.html has a list of three links: a relative link to pages/about.html, an absolute link to https://www.php.net and a mail link to aram@example.com. pages/about.html has a short text and a relative link back to index.html.
دوو دروست بکە. index.html لیستێکی سێ هەیە: بۆ pages/about.html، بۆ https://www.php.net و بۆ aram@example.com. pages/about.html دەقێکی کورت و هەیە بۆ گەڕانەوە بۆ index.html.
Hintئاماژە
From inside pages/, the home page is one folder up: ../.
لەناو pages/ـەوە، یەک لە سەرەوەیە: ../.
Show answerوەڵامەکە پیشان بدە
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home</title>
</head>
<body>
<h1>My site</h1>
<ul>
<li><a href="pages/about.html">About me</a></li>
<li><a href="https://www.php.net">The PHP website</a></li>
<li><a href="mailto:aram@example.com">Email me</a></li>
</ul>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home</title>
</head>
<body>
<h1>My site</h1>
<ul>
<li><a href="pages/about.html">About me</a></li>
<li><a href="https://www.php.net">The PHP website</a></li>
<li><a href="mailto:aram@example.com">Email me</a></li>
</ul>
</body>
</html><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>About me</title>
</head>
<body>
<h1>About me</h1>
<p>My name is Aram. I study web programming.</p>
<p><a href="../index.html">Back to the home page</a></p>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>About me</title>
</head>
<body>
<h1>About me</h1>
<p>My name is Aram. I study web programming.</p>
<p><a href="../index.html">Back to the home page</a></p>
</body>
</html>Write a class timetable with three columns (Day, 8:30 - 10:00, 10:15 - 11:45). On Sunday, the Web Programming lab fills both time slots. Databases is at 10:15 on both Monday and Tuesday, in one tall cell. Monday 8:30 is Networks and Tuesday 8:30 is English.
وانەکان بە سێ بنووسە (Day، 8:30 - 10:00، 10:15 - 11:45). ڕۆژی یەکشەممە Web Programming lab هەردوو کاتەکە پڕ دەکاتەوە. Databases لە کاتژمێر 10:15ی دووشەممە و سێشەممەدایە، لە یەک بەرزدا. دووشەممە 8:30 Networksە و سێشەممە 8:30 Englishە.
Hintئاماژە
Sunday needs colspan="2". The Databases cell needs rowspan="2", so Tuesday's row has only one <td>.
یەکشەممە پێویستی بە colspan="2" هەیە. Databases پێویستی بە rowspan="2" هەیە، بۆیە سێشەممە تەنها یەک <td>ـی هەیە.
Show answerوەڵامەکە پیشان بدە
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Timetable</title>
<style>
table, th, td { border: 1px solid #333; }
th, td { padding: 6px 10px; }
</style>
</head>
<body>
<table>
<tr>
<th>Day</th>
<th>8:30 - 10:00</th>
<th>10:15 - 11:45</th>
</tr>
<tr>
<th>Sunday</th>
<td colspan="2">Web Programming lab</td>
</tr>
<tr>
<th>Monday</th>
<td>Networks</td>
<td rowspan="2">Databases</td>
</tr>
<tr>
<th>Tuesday</th>
<td>English</td>
</tr>
</table>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Timetable</title>
<style>
table, th, td { border: 1px solid #333; }
th, td { padding: 6px 10px; }
</style>
</head>
<body>
<table>
<tr>
<th>Day</th>
<th>8:30 - 10:00</th>
<th>10:15 - 11:45</th>
</tr>
<tr>
<th>Sunday</th>
<td colspan="2">Web Programming lab</td>
</tr>
<tr>
<th>Monday</th>
<td>Networks</td>
<td rowspan="2">Databases</td>
</tr>
<tr>
<th>Tuesday</th>
<td>English</td>
</tr>
</table>
</body>
</html>This code was copied from slides and has many errors. Find them all and write a correct version.
ئەم کۆدە لە سلایدەوە کۆپی کراوە و زۆری تێدایە. هەموویان بدۆزەوە و وەشانێکی دروست بنووسە.
<html>
<head><title>My links</title></head>
<body>
< a href=“home.html”> Home</ a>
<a href="www.example.com">Example</a>
<table border=”1”>
<tr><th colspan=”2”>Students</th></tr>
<tr><td>Aram</td><td>Hana</td></tr>
</table>
<html>Show answerوەڵامەکە پیشان بدە
- No
<!DOCTYPE html>, nolangand no<meta charset="UTF-8">. < aand</ a>have spaces, so they are not tags.- Curly quotes in
href,borderandcolspan. www.example.comwithouthttps://is a relative link.- The last line is
<html>; it must be</html>. Andborderis better done with CSS.
<!DOCTYPE html>،langو<meta charset="UTF-8">نییە.< aو</ a>تێدایە، بۆیە نین.- خوار لە
href،borderوcolspanدا. www.example.comبەبێhttps://.- دوا دێڕ
<html>ـە؛ دەبێت</html>بێت. هەروەهاborderباشترە بە CSS بکرێت.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My links</title>
<style>
table, th, td { border: 1px solid #333; }
</style>
</head>
<body>
<a href="home.html">Home</a>
<a href="https://www.example.com">Example</a>
<table>
<tr><th colspan="2">Students</th></tr>
<tr><td>Aram</td><td>Hana</td></tr>
</table>
</body>
</html>HTML sent to the browserئەو HTMLـەی دەنێردرێت بۆ تۆڕگەڕ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My links</title>
<style>
table, th, td { border: 1px solid #333; }
</style>
</head>
<body>
<a href="home.html">Home</a>
<a href="https://www.example.com">Example</a>
<table>
<tr><th colspan="2">Students</th></tr>
<tr><td>Aram</td><td>Hana</td></tr>
</table>
</body>
</html>Build this table with one <table>. Count the columns first.
ئەم بە یەک <table> دروست بکە. سەرەتا بژمێرە.
Hintئاماژە
Five columns. 'Title goes here' has colspan="3"; C has rowspan="3", so rows 3 and 4 need one cell less. The same homework also asked for a 'Fresh Fruits' page with a picture beside the text built from a table: today that is page layout, so use CSS instead (the modern way).
پێنج . «ناونیشان لێرە دێت» colspan="3"ـی هەیە؛ C rowspan="3"ـی هەیە، بۆیە ٣ و ٤ یەک کەمتریان دەوێت. هەمان ئەرکی ماڵەوە داوای لاپەڕەیەکی «Fresh Fruits»ـیشی دەکرد کە وێنەیەک لە تەنیشت دەقەکە بە دابنرێت: ئەمڕۆ ئەمە ، بۆیە لە جیاتی ئەوە CSS بەکار بهێنە (ڕێگا نوێیەکە).
Show answerوەڵامەکە پیشان بدە
<table>
<tr><td colspan="3">Title goes here</td><td>A</td><td>B</td></tr>
<tr><td rowspan="3">C</td><td>D</td><td>E</td><td>F</td><td>G</td></tr>
<tr><td>H</td><td colspan="2">I</td><td rowspan="2">J</td></tr>
<tr><td>K</td><td>L</td><td>M</td></tr>
<tr><td>N</td><td colspan="4">O</td></tr>
</table>Check every row: 3 + 1 + 1, then 1 + 4, then (C) + 1 + 2 + 1, then (C) + 3 + (J), then 1 + 4: always five columns.
هەموو بپشکنە: ٣ + ١ + ١، پاشان ١ + ٤، پاشان (C) + ١ + ٢ + ١، پاشان (C) + ٣ + (J)، پاشان ١ + ٤: هەمیشە پێنج .
Write the HTML for this price list: caption "Mobile shop prices"; columns Id, Name, List price and Discount; three phones with list prices $600, $400 and $800; and one Discount cell, "15% of the list price", that covers all three phone rows. Give every phone its own id.
HTMLـی ئەم لیستی نرخە بنووسە: ناونیشانی «Mobile shop prices»؛ Id، Name، List price و Discount؛ سێ مۆبایل بە نرخی $600، $400 و $800؛ و یەک Discount، «15% of the list price»، کە هەر سێ مۆبایلەکان دادەپۆشێت. بە هەر مۆبایلێک ناسنامەیەکی (id) تایبەت بدە.
Hintئاماژە
The Discount cell is in the first phone row only, with rowspan="3"; the next two rows have three cells each.
Discount تەنها لە یەکەم مۆبایلدایە، بە rowspan="3"؛ دوو دواتر هەر یەکەیان سێ هەیە.
Show answerوەڵامەکە پیشان بدە
<table>
<caption>Mobile shop prices</caption>
<thead>
<tr><th>Id</th><th>Name</th><th>List price</th><th>Discount</th></tr>
</thead>
<tbody>
<tr><td>2026001</td><td>iPhone 16e</td><td>$600</td><td rowspan="3">15% of the list price</td></tr>
<tr><td>2026002</td><td>Galaxy A56</td><td>$400</td></tr>
<tr><td>2026003</td><td>Galaxy S25</td><td>$800</td></tr>
</tbody>
</table>The exam sheet this comes from gives two phones the same id. Ids must be unique, so each phone here has its own.
ئەو پەڕەی تاقیکردنەوەیەی ئەمەی لێوە هاتووە هەمان id دەداتە دوو مۆبایل. idـیەکان دەبێت جیاواز بن، بۆیە لێرەدا هەر مۆبایلێک هی خۆی هەیە.
Summary and reviewکورتە و پێداچوونەوە
- HTML marks up content with tags. The browser hides the tags and shows the content.
- An element = opening tag + content + closing tag. Attributes (
name="value") go in the opening tag, with straight quotes. - Every page:
<!DOCTYPE html>, then<html>with<head>(information) and<body>(what is shown). Add<meta charset="UTF-8">. - Links: absolute (
https://…), relative (home.html,../index.html) and mail (mailto:). - Tables:
<table>,<tr>,<th>,<td>;colspanmerges columns,rowspanmerges rows. - Tables are for data. Lay out pages with
<header>,<nav>,<main>,<footer>and CSS.
- HTML ناوەڕۆک بە نیشان دەکات. دەشارێتەوە و ناوەڕۆکەکە پیشان دەدات.
- = دەستپێک + ناوەڕۆک + کۆتایی. (
name="value") دەچنە ناو دەستپێک، بە ڕاست. - هەموو :
<!DOCTYPE html>، پاشان<html>لەگەڵ<head>(زانیاری) و<body>(ئەوەی پیشان دەدرێت).<meta charset="UTF-8">زیاد بکە. - : ڕەها (
https://…)، ڕێژەیی (home.html،../index.html) و ئیمەیڵ (mailto:). - :
<table>،<tr>،<th>،<td>؛colspanیەک دەخات،rowspanیەک دەخات. - بۆ دراوەن. بە
<header>،<nav>،<main>،<footer>و CSS دروست بکە.
What is the difference between a tag and an element?جیاوازیی نێوان تاگ و توخم چییە؟
A tag is the name in angle brackets, such as <p> or </p>. An element is the whole thing: opening tag, content and closing tag.
ئەو ناوەیە کە لەناو کەوانەی گۆشەییدایە، وەک <p> یان </p>. هەموو شتەکەیە: دەستپێک، ناوەڕۆک و کۆتایی.
What goes in the head, and what goes in the body?چی دەچێتە ناو head و چی دەچێتە ناو body؟
The head holds information about the page (title, character set, style sheets, scripts). The body holds everything shown in the browser window.
head زانیاری دەربارەی هەڵدەگرێت (ناونیشان، کۆمەڵەی پیتەکان، فایلەکانی شێواز، ). body هەموو ئەو شتانە هەڵدەگرێت کە لە پەنجەرەی پیشان دەدرێن.
Name the three kinds of hyperlinks, with an example of each.سێ جۆرەکەی بەستەر ناو بهێنە، بە نموونەیەک بۆ هەریەکەیان.
Absolute: <a href="https://www.google.com">Google</a>. Relative: <a href="home.html">Home</a>. Mail: <a href="mailto:info@example.com">Send email</a>.
ڕەها: <a href="https://www.google.com">Google</a>. ڕێژەیی: <a href="home.html">Home</a>. ئیمەیڵ: <a href="mailto:info@example.com">Send email</a>.
What do <th> and <td> create, and how do they look by default?<th> و <td> چی دروست دەکەن و بە شێوەی بنەڕەتی چۆنن؟
<th> creates a header cell, bold and centred. <td> creates a normal data cell.
<th> دروست دەکات، تۆخ و لە ناوەڕاست. <td> ئاسایی دراوە دروست دەکات.
Why did colspan=”2” on the slide not merge the cells?بۆچی colspan=”2” لە سلایدەکەدا خانەکانی یەک نەخست؟
Because of the curly quotes: the value ”2” is not a number, so the browser uses the default value 1.
بەهۆی خوارەوە: ”2” ژمارە نییە، بۆیە بنەڕەتی 1 بەکاردەهێنێت.
Is it a good idea to lay out a whole page with a table? Why?ئایا بیرۆکەیەکی باشە هەموو لاپەڕەتۆڕێک بە خشتەیەک ڕێکبخەیت؟ بۆچی؟
No. Tables are for tabular data. Table layouts are hard for screen readers, do not adapt to phones and mix content with design. Use semantic elements and CSS.
نەخێر. بۆ دراوەی خشتەیین. بە بۆ قورسە، لەگەڵ مۆبایل ناگونجێت و ناوەڕۆک لەگەڵ دیزاین تێکەڵ دەکات. واتادار و CSS بەکاربهێنە.
Videoڤیدیۆ
Watch a videoسەیری ڤیدیۆیەک بکە
A video that viewers liked a lot and praised in their comments, chosen for this lesson.ڤیدیۆیەک کە بینەران زۆریان پێ خۆش بووە و لە کۆمێنتەکانیاندا ستایشیان کردووە، بۆ ئەم وانەیە هەڵبژێردراوە.
A calm Kurdish review of HTML: what HTML is, the main tags (headings, paragraphs, links, lists, images, nav, footer, div), class and id.
پێداچوونەوەیەکی ئارام بە کوردی: چییە، گرنگترین وەک سەردێڕ، پەرەگراف، ، لیست، وێنە، nav، footer و div، لەگەڵ class و id.
Whole video: Kurdish overview of basic HTML tags
هەموو ڤیدیۆکە: بە کوردی گرنگترین دەناسێنێت.
Lesson complete!وانەکە تەواو بوو!
Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.
Key termsزاراوە سەرەکییەکان
HTML Text, Images and Listsدەق، وێنە و لیست لە HTMLـدا
Related lecturesوانە پەیوەندیدارەکان
References and further readingسەرچاوەکان و خوێندنەوەی زیاتر
- MDN: HTML basics
- MDN: Doctype
- MDN: The anchor element <a>
- MDN: The table element <table>
- MDN: CSS grid layout
- WHATWG HTML Living Standard: Tabular data
- WHATWG HTML Living Standard: Obsolete features
- W3C Markup Validation Service
- MDN: <tfoot> (order; HTML 4 note)
- MDN: <script> (placement and defer)
- W3C: XHTML 1.0 (first published 26 January 2000)
This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.