Introduction to HTML5: Part 1مقدمة في HTML5: الجزء الأول
مقدمة الفصل
ماذا ستتعلم في هذا الفصل
- Understand important components of HTML5 documents.
- Use HTML5 to create web pages.
- Add images to web pages.
- Create and use hyperlinks to help users navigate web pages.
- Mark up lists of information.
- Create tables with rows and columns of data.
- Create and use forms to get user input.
أقسام الفصل
- 1What HTML5 is and how documents are editedما HTML5 وكيف تُكتب المستندات
- 2Structure of an HTML5 documentبنية مستند HTML5
- 3Validation and headingsالتحقق والعناوين
- 4Linkingالروابط
- 5Imagesالصور
- 6Special characters and horizontal rulesالرموز الخاصة والخط الأفقي
- 7Listsالقوائم
- 8Tablesالجداول
- 9Formsالنماذج
- 10Internal linking and meta elementsالربط الداخلي وعناصر meta
تلميح: استخدم أسهم لوحة المفاتيح للتنقل بين الشرائح.
What is HTML5?ما HTML5؟
What HTML5 is and how documents are edited
A markup language that specifies the structure and content of documents that are displayed in web browsers.
Sophisticated HTML5 techniques
- Tables
- Forms
- Internal linking
- Meta elements
- HTML5 documents are typed in a text editor and saved with the .html or .htm extension.
- Web servers store HTML5 documents; clients (such as web browsers) request them.
DOCTYPE and commentsDOCTYPE والتعليقات
Structure of an HTML5 document
Required in HTML5 documents so that browsers render the page in standards mode. Some browsers operate in quirks mode to maintain backward compatibility with pages that are not up-to-date with the latest standards.
Start with <!-- and end with -->. They improve readability; the browser ignores comments when rendering.
html, head and bodyhtml و head و body
Structure of an HTML5 document
The html element encloses the head section and the body section.
headالرأس
- Information about the document
- Character set (UTF-8) and the title
- Can contain CSS3 style sheets and scripts
bodyالجسم
- The page's content
- Displayed when the user visits the page
Tags, attributes and the titleالوسوم والخصائص والعنوان
Structure of an HTML5 document
Start tag: the element name in angle brackets, e.g. <html>. End tag: the name preceded by a forward slash, e.g. </html>. Void elements do not have end tags.
Provides additional information about an element: a name and a value separated by an equals sign (=).
A nested element inside head. Appears in the title bar / browser tab and identifies bookmarks. Search engines use the title for indexing and when displaying results.
All text placed between <p> and </p> forms one paragraph.
سؤال سريع
Structure of an HTML5 document
Validation and headingsالتحقق والعناوين
- Syntactically correct HTML5 documents are guaranteed to render properly; documents with syntax errors may not display properly.
- Validation services (e.g., validator.w3.org) ensure a document is syntactically correct.
Six heading elements, h1 through h6. h1 is the most significant heading and is rendered in the largest font; each successive heading is rendered in a progressively smaller font.
Hyperlinksالروابط
Linking
References or links to other resources, such as HTML5 documents and images. Browsers typically underline text hyperlinks and color them blue by default.
- Links are created using the a (anchor) element.
- Attribute href specifies a resource's location: a web page or location within a page, a file, or an e-mail address.
- The strong element indicates that the content has high importance (typically bold).
- No specific document in the URL → the server returns a default web page, often index.html.
- Document not found → the server returns a 404 error.
Linking to an e-mail addressالربط بالبريد
Anchors can link to an e-mail address using a mailto: URL. When a user clicks it, most browsers launch the default e-mail program to write a message to the linked address.
سؤال سريع
Linking
Images: src and altالصور: src و alt
- The most popular image formats are PNG and JPEG.
Specifies the image's location.
Every img element must have an alt attribute: text displayed if the client cannot render the image. Speech synthesizer software can speak it, so it should describe the image's contents.
Optional. If omitted, the browser uses the image's actual width and height. Images are measured in pixels.
Void elements and image linksالعناصر الفارغة وروابط الصور
Images
Contain only attributes and do not mark up text. You can terminate them with a forward slash inside the closing angle bracket.
- By using images as hyperlinks, you can create graphical web pages that link to other resources.
سؤال سريع
Images
Special charactersالرموز الخاصة
Written in the form &code; for special characters that cannot be rendered otherwise. The code can be a word abbreviation or a number (decimal or hexadecimal).
| Symbolالرمز | Descriptionالوصف | Character entity referenceمرجع الكيان |
|---|---|---|
| & | ampersand |
|
| ' | apostrophe |
|
| > | greater-than |
|
| < | less-than |
|
| " | quote |
|
| (space) | non-breaking space |
|
| © | copyright |
|
| — | em dash |
|
| – | en dash |
|
| ¼ | fraction 1/4 |
|
| ½ | fraction 1/2 |
|
| ¾ | fraction 3/4 |
|
| … | horizontal ellipsis |
|
| ® | registered trademark |
|
| § | section |
|
| ™ | trademark |
|
hr, del, sub and suphr و del و sub و sup
Special characters and horizontal rules
Inserts a horizontal rule.
Strikes through text.
Subscript text, e.g. x<sub>1</sub>.
Superscript text, e.g. 10<sup>2</sup>.
سؤال سريع
Special characters and horizontal rules
Listsالقوائم
ul — unordered listقائمة غير مرتبة
- Each item begins with a bullet symbol (typically a disc)
ol — ordered listقائمة مرتبة
- Each item begins with a number
- Each entry is an li (list item) element.
- Lists may be nested to represent hierarchical relationships, as in a multi-level outline.
Tablesالجداول
Tables organize data into rows and columns.
| Element / attributeالعنصر / الخاصية | Purpose on the slidesالوظيفة |
|---|---|
| table | Defines an HTML5 table |
| summary (attribute) |
|
| caption | The table's title |
| thead | Head section: table titles, column headers |
| tbody | Body section: primary table data |
| tfoot | Foot section: calculation results, footnotes (coded above the body, displayed at the bottom) |
| tr | A table row |
| th | A header cell |
| td | A data cell |
| rowspan / colspan | Number of rows / columns a cell occupies |
br: a legacy formatting elementالعنصر br
Tables
- The br element is rendered as a line break in most browsers; anything after it is rendered on the next line.
- Like img, br is a void element.
- Like hr, br is considered a legacy formatting element that you should avoid — formatting should be specified using CSS.
سؤال سريع
Tables
The form elementعنصر النموذج
Forms
method = "post"
- Appends form data to the browser request (which contains the protocol and the requested resource's URL)
method = "get"
- Appends form data to the end of the URL
- Visible in the browser's Address field
Specifies the script to which the form data will be sent (the form handler).
Nonvisual components that store any data you specify, such as e-mail addresses and file names.
Form componentsمكونات النموذج
Forms
| Form componentالمكون | What the slides sayما تقوله الشرائح |
|---|---|
| form method="post" | Appends form data to the browser request |
| form method="get" | Appends form data to the end of the URL, visible in the Address field |
| form action | The script that receives the data (form handler) |
| input type="hidden" |
|
| input type="text" |
|
| input type="password" |
|
| input type="checkbox" | Selectable individually or in groups (same name) |
| input type="radio" | Only one in a group selectable (same name, different value) |
| input type="submit" |
|
| input type="reset" | Resets all form elements to default values |
| textarea | Multiline text area (rows, cols) |
| select / option | Drop-down list / its items |
سؤال سريع
Forms
Checkboxes, radio buttons and selectالاختيارات والقوائم
Forms
checkbox
- A check mark appears when selected
- Used individually or in groups
- Same group = same name
radio
- Only one in a group can be selected at any time
- Same name, different value attributes
- select provides a drop-down list; its name identifies it, and option elements add the items.
سؤال سريع
Forms
Internal linking and meta elementsالربط الداخلي و meta
The a tag can link to another section of the same document by specifying the element's id as the link's href, using the syntax #id.
content provides search engines with a list of words that describe a page, compared with words in search requests.
content provides a three- to four-line description of a site in sentence form, used by search engines to catalog the site; sometimes displayed in the search result.
سؤال سريع
Internal linking and meta elements
الخلاصة
أنهيت الدرس
الخطوة التالية: ثبّت المعلومات بالبطاقات، ثم اختبر نفسك بالأسئلة.
ما راجعته في هذا الدرس
- What HTML5 is and how documents are editedما HTML5 وكيف تُكتب المستندات
- Structure of an HTML5 documentبنية مستند HTML5
- Validation and headingsالتحقق والعناوين
- Linkingالروابط
- Imagesالصور
- Special characters and horizontal rulesالرموز الخاصة والخط الأفقي
- Listsالقوائم
- Tablesالجداول
- Formsالنماذج
- Internal linking and meta elementsالربط الداخلي وعناصر meta