Introduction to HTML5: Part 1مقدمة في HTML5: الجزء الأول

الشريحة 1 من 28

مقدمة الفصل

ماذا ستتعلم في هذا الفصل

  1. Understand important components of HTML5 documents.
  2. Use HTML5 to create web pages.
  3. Add images to web pages.
  4. Create and use hyperlinks to help users navigate web pages.
  5. Mark up lists of information.
  6. Create tables with rows and columns of data.
  7. Create and use forms to get user input.
تفاصيل المصدرالفصل 2 · الشريحة ⁦3⁩
المصدر
الفصل 2 · الشريحة ⁦3⁩

What is HTML5?ما HTML5؟

What HTML5 is and how documents are edited

HTML5 (HyperText Markup Language 5)
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.
تفاصيل المصدرالفصل 2 · الشرائح ⁦6–7⁩
المصدر
الفصل 2 · الشرائح ⁦6–7⁩

DOCTYPE and commentsDOCTYPE والتعليقات

Structure of an HTML5 document

Document type declaration (DOCTYPE)
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.
Comments
Start with <!-- and end with -->. They improve readability; the browser ignores comments when rendering.
تفاصيل المصدرالفصل 2 · الشرائح ⁦9–11⁩
المصدر
الفصل 2 · الشرائح ⁦9–11⁩

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
تفاصيل المصدرالفصل 2 · الشريحة ⁦12⁩
المصدر
الفصل 2 · الشريحة ⁦12⁩

Tags, attributes and the titleالوسوم والخصائص والعنوان

Structure of an HTML5 document

Start tag / end tag
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.
Attribute
Provides additional information about an element: a name and a value separated by an equals sign (=).
title
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.
p
All text placed between <p> and </p> forms one paragraph.
تفاصيل المصدرالفصل 2 · الشرائح ⁦13–15⁩
المصدر
الفصل 2 · الشرائح ⁦13–15⁩

سؤال سريع

Structure of an HTML5 document

Where should the page's character set (UTF-8) and title be placed?

تفاصيل المصدرالفصل 2 · الشريحة ⁦12⁩
المصدر
الفصل 2 · الشريحة ⁦12⁩

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.
Headings
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.
تفاصيل المصدرالفصل 2 · الشرائح ⁦16–18⁩
المصدر
الفصل 2 · الشرائح ⁦16–18⁩

Hyperlinksالروابط

Linking

Hyperlink
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.
تفاصيل المصدرالفصل 2 · الشرائح ⁦19, 21⁩
المصدر
الفصل 2 · الشرائح ⁦19, 21⁩

Linking to an e-mail addressالربط بالبريد

mailto: URL
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.

من الشرائح

  • <a href = "mailto:deitel@deitel.com">Send an email to Deitel &amp; Associates, Inc.</a>
تفاصيل المصدرالفصل 2 · الشرائح ⁦22, 37⁩
المصدر
الفصل 2 · الشرائح ⁦22, 37⁩

سؤال سريع

Linking

Which markup creates a link that opens the user's e-mail program to write to help@uni.edu?

تفاصيل المصدرالفصل 2 · الشريحة ⁦22⁩
المصدر
الفصل 2 · الشريحة ⁦22⁩

Images: src and altالصور: src و alt

  • The most popular image formats are PNG and JPEG.
src
Specifies the image's location.
alt
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.
width / height
Optional. If omitted, the browser uses the image's actual width and height. Images are measured in pixels.
تفاصيل المصدرالفصل 2 · الشرائح ⁦24, 27, 28⁩
المصدر
الفصل 2 · الشرائح ⁦24, 27, 28⁩

Void elements and image linksالعناصر الفارغة وروابط الصور

Images

Void elements
Contain only attributes and do not mark up text. You can terminate them with a forward slash inside the closing angle bracket.

من الشرائح

  • <img src = "jhtp.png" width = "92" height = "120" alt = "Java How to Program book cover" />
  • By using images as hyperlinks, you can create graphical web pages that link to other resources.
تفاصيل المصدرالفصل 2 · الشرائح ⁦29–30⁩
المصدر
الفصل 2 · الشرائح ⁦29–30⁩

سؤال سريع

Images

Which img tag is correct and complete for an image logo.png that is 150 × 60 pixels?

تفاصيل المصدرالفصل 2 · الشرائح ⁦27–28⁩
المصدر
الفصل 2 · الشرائح ⁦27–28⁩

Special charactersالرموز الخاصة

Character entity references
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).
Fig. 2.8 — Some common HTML character entity references
SymbolالرمزDescriptionالوصفCharacter entity referenceمرجع الكيان
&ampersand
  • &amp
'apostrophe
  • &apos
>greater-than
  • &gt
<less-than
  • &lt
"quote
  • &quot
(space)non-breaking space
  • &nbsp
©copyright
  • &copy
—em dash
  • &mdash
–en dash
  • &ndash
¼fraction 1/4
  • &frac14
½fraction 1/2
  • &frac12
¾fraction 3/4
  • &frac34
…horizontal ellipsis
  • &hellip
®registered trademark
  • &reg
§section
  • &sect
™trademark
  • &trade
تفاصيل المصدرالفصل 2 · الشرائح ⁦33–35⁩
المصدر
الفصل 2 · الشرائح ⁦33–35⁩

hr, del, sub and suphr و del و sub و sup

Special characters and horizontal rules

<hr>
Inserts a horizontal rule.
<del>
Strikes through text.
<sub>
Subscript text, e.g. x<sub>1</sub>.
<sup>
Superscript text, e.g. 10<sup>2</sup>.

من الشرائح

  • <p>All information on this site is <strong>&copy; Deitel &amp; Associates, Inc. 2012.</strong></p>
تفاصيل المصدرالفصل 2 · الشرائح ⁦37–38⁩
المصدر
الفصل 2 · الشرائح ⁦37–38⁩

سؤال سريع

Special characters and horizontal rules

Which line displays "Prices < 5 & falling" correctly using character entity references?

تفاصيل المصدرالفصل 2 · الشريحة ⁦34⁩
المصدر
الفصل 2 · الشريحة ⁦34⁩

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.
تفاصيل المصدرالفصل 2 · الشرائح ⁦39, 41⁩
المصدر
الفصل 2 · الشرائح ⁦39, 41⁩

Tablesالجداول

Tables organize data into rows and columns.

Element / attributeالعنصر / الخاصيةPurpose on the slidesالوظيفة
tableDefines an HTML5 table
summary (attribute)
  • Summarizes the contents
  • used by speech devices
captionThe table's title
theadHead section: table titles, column headers
tbodyBody section: primary table data
tfootFoot section: calculation results, footnotes (coded above the body, displayed at the bottom)
trA table row
thA header cell
tdA data cell
rowspan / colspanNumber of rows / columns a cell occupies
تفاصيل المصدرالفصل 2 · الشرائح ⁦45, 49, 50, 51⁩
المصدر
الفصل 2 · الشرائح ⁦45, 49, 50, 51⁩

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.
تفاصيل المصدرالفصل 2 · الشريحة ⁦51⁩
المصدر
الفصل 2 · الشريحة ⁦51⁩

سؤال سريع

Tables

A grades table needs a visible title "Midterm results" and a footnote row with the class average. Which elements are used for these two parts?

تفاصيل المصدرالفصل 2 · الشرائح ⁦45, 49⁩
المصدر
الفصل 2 · الشرائح ⁦45, 49⁩

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
action
Specifies the script to which the form data will be sent (the form handler).
Hidden inputs
Nonvisual components that store any data you specify, such as e-mail addresses and file names.
تفاصيل المصدرالفصل 2 · الشرائح ⁦58–60⁩
المصدر
الفصل 2 · الشرائح ⁦58–60⁩

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 actionThe script that receives the data (form handler)
input type="hidden"
  • Nonvisual
  • stores data you specify
input type="text"
  • A text field
  • size = visible characters, maxlength = limit
input type="password"
  • Masks input (usually asterisks)
  • real value is sent
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"
  • Sends data to the action location
  • value = button text
input type="reset"Resets all form elements to default values
textareaMultiline text area (rows, cols)
select / optionDrop-down list / its items
تفاصيل المصدرالفصل 2 · الشرائح ⁦61, 62, 63, 69, 70⁩
المصدر
الفصل 2 · الشرائح ⁦61, 62, 63, 69, 70⁩

سؤال سريع

Forms

After a search form is submitted, the user sees the typed words in the browser's Address field. Which form setting caused this?

تفاصيل المصدرالفصل 2 · الشريحة ⁦58⁩
المصدر
الفصل 2 · الشريحة ⁦58⁩

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.
تفاصيل المصدرالفصل 2 · الشريحة ⁦70⁩
المصدر
الفصل 2 · الشريحة ⁦70⁩

سؤال سريع

Forms

A survey asks "Your year: 1, 2, 3 or 4" and the student must be able to choose only one. Which form component fits, and how must the options be written?

تفاصيل المصدرالفصل 2 · الشريحة ⁦70⁩
المصدر
الفصل 2 · الشريحة ⁦70⁩

Internal linking and meta elementsالربط الداخلي و meta

Internal linking
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.
meta name="keywords"
content provides search engines with a list of words that describe a page, compared with words in search requests.
meta name="description"
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.
تفاصيل المصدرالفصل 2 · الشرائح ⁦71, 77⁩
المصدر
الفصل 2 · الشرائح ⁦71, 77⁩

سؤال سريع

Internal linking and meta elements

Which pair is correct?

تفاصيل المصدرالفصل 2 · الشرائح ⁦71, 77⁩
المصدر
الفصل 2 · الشرائح ⁦71, 77⁩

الخلاصة

تفاصيل المصدر
المصدر
الفصل 2

خريطة الفصل

    1. 1مقدمة الفصل
  1. What HTML5 is and how documents are editedما HTML5 وكيف تُكتب المستندات

    1. 2What is HTML5?ما HTML5؟
  2. Structure of an HTML5 documentبنية مستند HTML5

    1. 3DOCTYPE and commentsDOCTYPE والتعليقات
    2. 4html, head and bodyhtml و head و body
    3. 5Tags, attributes and the titleالوسوم والخصائص والعنوان
    4. 6سؤال سريع: head
    1. 7Validation and headingsالتحقق والعناوين
  3. Linkingالروابط

    1. 8Hyperlinksالروابط
    2. 9Linking to an e-mail addressالربط بالبريد
    3. 10سؤال سريع: رابط البريد
  4. Imagesالصور

    1. 11Images: src and altالصور: src و alt
    2. 12Void elements and image linksالعناصر الفارغة وروابط الصور
    3. 13سؤال سريع: الصور
  5. Special characters and horizontal rulesالرموز الخاصة والخط الأفقي

    1. 14Special charactersالرموز الخاصة
    2. 15hr, del, sub and suphr و del و sub و sup
    3. 16سؤال سريع: الرموز
    1. 17Listsالقوائم
  6. Tablesالجداول

    1. 18Tablesالجداول
    2. 19br: a legacy formatting elementالعنصر br
    3. 20سؤال سريع: الجداول
  7. Formsالنماذج

    1. 21The form elementعنصر النموذج
    2. 22Form componentsمكونات النموذج
    3. 23سؤال سريع: get و post
    4. 24Checkboxes, radio buttons and selectالاختيارات والقوائم
    5. 25سؤال سريع: الراديو
  8. Internal linking and meta elementsالربط الداخلي وعناصر meta

    1. 26Internal linking and meta elementsالربط الداخلي و meta
    2. 27سؤال سريع: meta
    1. 28الخلاصة