Introduction to HTML5

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Which filename extensions are used when saving HTML5 documents?

  • .html and .htm (correct)
  • .html5 and .htm5
  • .xml and .css
  • .js and .php

What is the primary function of web servers?

  • To render HTML5 documents.
  • To create HTML5 documents.
  • To store HTML5 documents. (correct)
  • To edit HTML5 documents.

What is the role of a client (such as a web browser) in relation to web servers?

  • To request specific resources like HTML5 documents. (correct)
  • To manage web server configurations.
  • To create HTML5 documents on the server.
  • To store HTML5 documents.

What is the purpose of the document type declaration (DOCTYPE) in HTML5?

<p>To instruct browsers to render the page in standards mode. (B)</p> Signup and view all the answers

What is the purpose of comments in HTML5 markup?

<p>To improve readability and describe the content of the document. (C)</p> Signup and view all the answers

Which of the following best describes an HTML5 start tag?

<p>The element name in angle brackets. (A)</p> Signup and view all the answers

What is the correct structure of an HTML5 end tag?

<p>The element name preceded by a forward slash in angle brackets. (A)</p> Signup and view all the answers

What are 'void elements' in HTML5?

<p>Elements that do not have end tags. (A)</p> Signup and view all the answers

In HTML5, what provides additional information about an element and influences how a browser processes it?

<p>Attributes (A)</p> Signup and view all the answers

What does the html element enclose in an HTML5 document?

<p>Both the head and body sections (A)</p> Signup and view all the answers

Which section of an HTML5 document contains information such as the character set and the title?

<p>The head section (C)</p> Signup and view all the answers

Which section of an HTML5 document contains the content that is displayed by the browser?

<p>The body section (D)</p> Signup and view all the answers

Where does the title of a webpage typically appear?

<p>In the title bar of the browser window or in the browser tab. (B)</p> Signup and view all the answers

Which HTML5 element is considered the most significant heading and is rendered in the largest font by default?

<p>h1 (A)</p> Signup and view all the answers

What happens to the font size as you progress from h1 to h6 heading elements?

<p>The font size decreases. (B)</p> Signup and view all the answers

Why is it important to ensure HTML5 documents are syntactically correct?

<p>To guarantee the document will render properly. (C)</p> Signup and view all the answers

What is the typical appearance of text hyperlinks in web browsers by default?

<p>Underlined and blue (B)</p> Signup and view all the answers

What does the href attribute in an anchor element specify?

<p>The location of the linked resource. (C)</p> Signup and view all the answers

What is a '404 error'?

<p>An error indicating the web server cannot locate the requested document. (B)</p> Signup and view all the answers

When linking to an email address, what URL scheme is used?

<p>mailto: (C)</p> Signup and view all the answers

What is the purpose of the HTML <strong> element?

<p>To emphasize text with bold font (B)</p> Signup and view all the answers

Which of the following are popular image formats used by web developers?

<p>PNG and JPEG (B)</p> Signup and view all the answers

What is the purpose of the src attribute in the <img> element?

<p>To specify the location of the image file. (C)</p> Signup and view all the answers

Why should every img element have an alt attribute?

<p>To provide alternative text if the image cannot be displayed and to improve accessibility. (D)</p> Signup and view all the answers

What is a 'void element' in the context of images in HTML5?

<p>An image element that does not have an end tag. (A)</p> Signup and view all the answers

What is represented by character entity references?

<p>Special characters (B)</p> Signup and view all the answers

What HTML element is used to create an unordered list?

<ul> (B) Signup and view all the answers

What does the li element represent in HTML lists?

<p>List item (C)</p> Signup and view all the answers

What HTML element is used to create a list where each item begins with a number?

<ol> (D) Signup and view all the answers

Which HTML element defines a table?

<table> (B) Signup and view all the answers

What is the purpose of the summary attribute in a table?

<p>To summarize the table's contents for speech devices to improve accessibility. (C)</p> Signup and view all the answers

Which HTML table element specifies a table's title?

<caption> (A) Signup and view all the answers

What is the purpose of the HTML form element?

<p>To collect information from users. (B)</p> Signup and view all the answers

What does the method attribute of the form element specify?

<p>How the form's data is sent to the web server. (A)</p> Signup and view all the answers

What is the purpose of 'hidden' input elements in an HTML form?

<p>To store data that is not visible to the user but is submitted with the form. (D)</p> Signup and view all the answers

What does the type attribute of an HTML <input> element determine?

<p>The kind of input field (e.g., text, password, checkbox). (D)</p> Signup and view all the answers

What does the 'submit' input element do in a form?

<p>It sends the form's data to the server. (C)</p> Signup and view all the answers

What does the 'reset' input element do in a form?

<p>It resets all form elements to their default values. (B)</p> Signup and view all the answers

Which element is used to insert a multiline text area into a form?

&lt;textarea> (C) Signup and view all the answers

What attribute specifies the visible width of a text input field?

<p>size (B)</p> Signup and view all the answers

Which attribute limits the number of characters that can be input into a text field?

<p>maxlength (A)</p> Signup and view all the answers

Flashcards

What is HTML5?

Specifies the structure and content of documents displayed in web browsers.

What are Web Servers?

Computers that store HTML5 documents.

What are Clients?

Requests specific resources, like HTML5 documents, from web servers.

What is the DOCTYPE declaration?

It is required in HTML5 documents so that browsers render the page in standards mode.

Signup and view all the flashcards

What is a start tag?

An element name enclosed in angle brackets and delimits most elements in HTML5 documents.

Signup and view all the flashcards

What is an end tag?

An element name preceded by a forward slash (/) in angle brackets.

Signup and view all the flashcards

What are void elements?

Elements that do not have end tags.

Signup and view all the flashcards

What is an attribute?

It provides additional information about an element and tells browsers how to process the element.

Signup and view all the flashcards

What is the head section?

It contains information about the HTML5 document, such as the character set and the title.

Signup and view all the flashcards

What is the body section?

It contains the page's content, which the browser displays when the user visits the web page.

Signup and view all the flashcards

What is the title element?

It describes the web page. Titles appear in the browser window's title bar, and search engines use it for indexing.

Signup and view all the flashcards

What is the Paragraph Element?

All text placed between the

and

tags forms one paragraph.

Signup and view all the flashcards

What are Heading elements?

HTML5 provides six heading elements (h1 through h6) for specifying the importance of information.

Signup and view all the flashcards

What is a hyperlink?

A hyperlink references or links to other resources, such as HTML5 documents and images.

Signup and view all the flashcards

What is the href attribute?

It specifies a resource's location, such as a web page, a file, or an email address.

Signup and view all the flashcards

What does mailto do?

Anchors can link to an e-mail address using a mailto: URL.

Signup and view all the flashcards

What are popular image formats?

The most popular image formats used by web developers today are PNG (Portable Network Graphics) and JPEG (Joint Photographic Experts Group).

Signup and view all the flashcards

What is the src attribute?

Specifies an image's location.

Signup and view all the flashcards

What is the alt attribute?

It makes web pages more accessible to users with disabilities, especially vision impairments.

Signup and view all the flashcards

What are character entity references?

HTML5 provides character entity references (in the form &code;) for representing special characters that cannot be rendered otherwise.

Signup and view all the flashcards

What does the


tag do?

Renders a horizontal line with extra space above and below it in most browsers.

Signup and view all the flashcards

What is an unordered list?

It creates a list in which each item in the list begins with a bullet symbol (typically a disc).

Signup and view all the flashcards

What is a ordered list?

It creates a list in which each item begins with a number.

Signup and view all the flashcards

What does table summary attribute do?

It summarizes the table's contents and is used by speech devices to make the table more accessible to users with visual impairments.

Signup and view all the flashcards

What is the caption element?

It specifies a table's title.

Signup and view all the flashcards

What is the Element?

Element that defines individual table rows.

Signup and view all the flashcards

What is the Element?

Defines a header cell.

Signup and view all the flashcards

What is the Element?

Contains table data elements.

Signup and view all the flashcards

What do the rowspan and colspan attributes do?

These allow you to build more complex tables. The values of these attributes specify the number of rows or columns occupied by the cell.

Signup and view all the flashcards

What are forms used for?

HTML5 provides forms for collecting information from users.

Signup and view all the flashcards

What does the method attribute specify?

Specifies how the form's data is sent to the web server. Using method = "post" appends form data to the browser request. method = "get" appends the form data directly to the end of the URL of the script

Signup and view all the flashcards

What does the action attribute specify?

Specifies the script to which the form data will be sent.

Signup and view all the flashcards

What are visual components?

Include clickable buttons and other graphical user interface components with which users interact.

Signup and view all the flashcards

What are Nonvisual components?

Called hidden inputs, store any data that you specify, such as e-mail addresses and HTML5 document file names that act as links.

Signup and view all the flashcards

What does <input type="text"> do?

It inserts a text field in the form for user data input.

Signup and view all the flashcards

What does the

Provides users with information about the input element's purpose.

Signup and view all the flashcards

What does the maxlength attribute do?

Limits the number of characters input into a text field.

Signup and view all the flashcards

What does the submit input element do?

The form's data is sent to the location specified in the form's action attribute.

Signup and view all the flashcards

What does the reset input element do?

It allows a user to reset all form elements to their default values.

Signup and view all the flashcards

What does the <textarea> element do?

It inserts a multiline text area into the form.

Signup and view all the flashcards

What does id mean?

The a tag can be used to link to another section of the same document by specifying the element's id as the link's href.

Signup and view all the flashcards

Study Notes

Objectives

  • Grasp essential HTML5 components
  • Utilize HTML5 for web page creation
  • Incorporate images into web pages
  • Design and implement hyperlinks
  • Format lists and other information
  • Construct data tables (rows, columns)
  • Build input forms

Introduction

  • HTML5 is a markup language dictating the structure and content of web documents displayed in internet browsers.
  • Tables are used for structuring information from databases, visitor forms for collecting information from visitors, internal linking, and meta elements for specifying document information.

Editing HTML5

  • HTML5 documents are created by typing markup text in a text editor and saving it with a .html or .htm extension.
  • Web servers store HTML5 documents.
  • Clients (web browsers on computers and smartphones), request specific resources from web servers, such as HTML5 documents.
  • The first example message shows "welcome to HTML5!" in the browser.

Document Type Declaration

  • Declaring document type(DOCTYPE) is required in HTML5 so that browsers render the page in standards mode.
  • Some browsers operate in Quirks Mode to maintain backward compatibility and are not up-to-date with standards.
  • Inserting comments in HTML5 markup to improve readability and describe the content of a document.
  • Browsers ignore comments when rendering documents.
  • Comments start with <!-- and end with -->.

Start and End Tags

  • HTML5 documents delimit most elements with a start tag and end tag.
  • A start tag includes the element name in angle brackets.
  • An end tag includes the element name preceded by a forward slash (/) in angle brackets.
  • Void elements don't have end tags.
  • Start tags can have attributes to provide element information and are used to determine how to process the element.
  • Each attribute has a name and a value separated by an equals sign (=).
  • It is good practice to use lowercase letters for HTML5 element and attribute names.

HTML, Head and Body Elements

  • Markup contains text, images, graphics, animations, audios and videos, which represents a document's content and elements that specify the document's structure and meaning.
  • The html element encloses the head element.
  • The head section contains information about the HTML5 document, such as character sets and title.
  • The head can contain CSS3 style sheets and client-side programs called scripts.
  • The body section contains the page's content, and is displayed by the browser.

Title Element

  • The title element, enclosed in the head element, is a nested element.
  • The head element is nested inside the html element is nested.
  • Titles appear in the title bar, browser tab, and bookmarks, enabling users to return to their favorite sites.
  • Search engines use the title for indexing purposes.
  • Indenting nested elements emphasizes document structure and readability.

Paragraph Element

  • All text between <p> and </p> form one paragraph.

Headings

  • Six heading elements (h1 through h6) specify the importance of information.
  • The <h1> tag is considered the most significant heading element and is rendered in the largest font.
  • Each successive heading element (i.e., h2, h3, etc.) is rendered in a progressively smaller font.

W3C HTML5 Validation Service

  • HTML5 documents that are syntactically correct render properly and are guaranteed.
  • HTML5 documents with syntax errors might not display properly.
  • Validation services ensure that an HTML5 document is syntactically correct, such as validator.w3.org/#validate-by-upload.
  • Browsers attempt to render invalid HTML5 documents, however that can lead to undesirable results.

Linking

  • An hyperlink contains a link to other resources and HTML5 documents and images in the same location.
  • Web browsers underline text hyperlinks and color them blue by default.
  • Links are created using the <a> (anchor) element.
  • Attribute href(hypertext reference) specifies a resource's location.
  • The href attribute specifies a web page, file, or email address.
  • When a URL lacks a specific document, web servers return a default Web page.
  • The default Web page is referred to as index.html, however a web server can be configured to use any file.
  • Web servers return error indications to browsers (404 error) when a document cannot be located.
  • Browsers will display a web page containing an error message in this case.
  • The <strong> element indicates content that is highly important, and browsers typically render such text in a bold font.
  • Enclosing the attribute values in single or double quotes where is recommended.
  • Anchors can link to an e-mail address using a mailto: URL.
  • When a user clicks this type of anchored link, most browsers launch the default e-mail program (e.g., Mozilla Thunderbird, Microsoft Outlook or Apple Mail) to enable the user to write an e-mail message to the linked address.

Images

  • Popular image formats used by web developers are PNG (Portable Network Graphics) and JPEG (Joint Photographic Experts Group).
  • Images can be created using specialized software, such as Adobe Photoshop, G.I.M.P., Inkscape.
  • Images may also be acquired from websites, many of which offer royalty-free images.
  • The img element's src attribute specifies an image's location.
  • An img element must have an alt attribute that displays text when the client cannot render the image.
  • The alt attribute makes web pages more accessible to users, especially those with vision impairments.
  • width and height are optional attributes
  • If width and height are omitted, the browser uses the image's actual width and height
  • Images are measured in pixels.
  • Include an image's width and height within the <img> tag so the browser accurately allocates screen space before downloading it.
  • Avoid distorting images by preserving the width-to-height ratio when defining new dimensions.

Void Elements

  • Some HTML5 elements (void elements) contain only attributes and do not mark up texts.
  • Void elements (such as the img element) can be terminated by using the forward slash character (/) inside the closing right angle bracket (>) of the start tag.
  • Images can be used as hyperlinks to create graphical web pages that link to resources.

Special Characters and Horizontal Rules

  • HTML5 provides character entity references (&code;) for characters that cannot be rendered otherwise.
  • The code in special characters can be word abbreviations, numbers(decimal and hexadecimal).
  • An horizontal rule, indicated by the <hr> tag, renders a horizontal line with extra space above and below it in most browsers.
  • The <hr> element is considered a legacy element that has been deprecated.
  • HTML5 character can be represented as numeric character references-decimal or hexadecimal.

Lists

  • The <ul> (unordered list)element creates a bulleted list.
  • Each entry is an <li> (list item) element.

Nested and Ordered Lists

  • Lists can be nested to represent hierarchical relationships.
  • The <ol> (ordered list) element creates a numbered list.

Tables

  • Tables are frequently used to organize data into rows and columns.
  • The <table>element defines an HTML5 table.
  • The summary attribute summarizes the table's contents, this helps visually impaired users using the table.
  • The caption element specifies a table's title.
  • A recommended practice is including a general description of a table's information in the table element's summary attribute for accessibility and web pages.
  • Tables split into three sections: Head ( element), Body ( element), and Foot ( element).
  • The element holds table titles and column headers.
  • The element displays the primary and necessary data for table.
  • The element shows calculation results and footnotes.
  • The element appears above the body, but displays it in the bottom of every page.
  • The <tr> element that defines individual table rows.
  • The element defines a header cell.
  • The element contains table data elements.

Using rowspan and colspan with Tables

  • Combining data cells is possible with the rowspan and colspan attributes.
  • The values of these attributes specify the number of rows or columns occupied by the cell.
  • The attributes can be placed inside any data cell or table header cell.
  • The <br> element renders as a line brake, mark up or text following a <br>element, and it is rendered on the next line.
  • Like the <img> element, <br> is an example of a void element.
  • Like the <hr> element, br is considered a legacy formatting element and should be specified with CSS.

Forms

  • Forms are a tool for collecting information from users.

Method Attribute of the Form Element

  • A form uses the <form> element to define the form.
  • Attribute method, specifies how a form's data is sent to the web server
  • Using method = "post" appends form data to the browser request, which contains the protocol (HTTP) and the requested resource's URL.
  • Using method = "get" appends, the form data directly to the URL script and is visible in the browser's Address field.
  • The action attribute specifies the script for form data to be sent to.

Action Attribute of the Form Element

  • The action attribute for the form element specifies the script to which the form data will be sent.
  • Since server-side programming has not been introduced yet, setting to http://www.deitel.com for now.
  • input elements specify data to provide to the script that processes the form, and is also referred to as form handler.
  • An input's type is determined by its type attribute.

Hidden Inputs

  • Forms can contain visual components and nonvisual components.
  • Visual components-include clickable buttons and other GUI components with which users interact.
    • Nonvisual Components- "Hidden Inputs" store any data the developer wishes to specify.

Text input Element

  • The <input> of type text inserts a text field into a form.
  • The <label> element provides the purpose about the input element's purpose
  • The size attribute specifies the number of characters visible in the text field.
  • The optional attribute maxlength limits the number of characters input into a text field.

Submit and Reset input Elements

  • submit input element is a button.
    • When the submit button is pressed, the form's data is sent to the location specified in the form's action attribute.
  • The value attribute sets the text displayed on the button.
  • The reset input element allows a user to reset all form elements to their default values.

Additional Form Elements

  • There is a form that solicits user feedback about a website.
  • The <textarea> element inserts a multiline text area into the form.
  • The rows attribute specifies a number of rows, and the columns attribute specifies characters per line.
  • Default text can be specified in fields by using the value attribute

Forms - password attribute

  • The input of type "password" inserts a password box into a form.
  • Allows users to enter sensitive information, such as credit card numbers and passwords, by masking the information input with another character, usually asterisks.
  • The actual value input is sent to the web server,not the asterisks that mask the input.

Forms - Checkbox attribute

The checkbox input element enables users to select and option.

  • When the checkbox is selected, a check mark appears in the checkbox. Otherwise, the checkbox is empty.
  • Checkboxes used individually and in groups, those that are part of the same group have the same name.
  • radio buttons are similar to checkboxes, except that only one radio button in a group can be selected at any time.
  • All radio buttons in a group have the same name attribute but different value attributes.
  • The select input provides a drop-down list of items.
  • The name attribute identifies the drop-down list, and the Option element adds items to the drop-down list.

Internal Linking

  • The <a> tag can be used to link to another section of the same document by specifying the element's id as the link's href.
  • To link internally to an element with its id attribute set, use the syntax #id.

Meta Elements

  • Reading the <meta> element's contents is one way search engines catalog pages.
  • The name attribute identifies the type of meta element.
  • The content attribute determines the keywords and description.
    • In Search engines, a list of content words with descriptions make web pages easy to find.
    • Also helps the search engine catalog an internet website. These elements must be placed inside the head section of an HTML5 document.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

HTML Basics PDF

More Like This

Use Quizgecko on...
Browser
Browser