Podcast
Questions and Answers
What is the primary function of HTML?
What is the primary function of HTML?
- To style web pages
- To add interactivity to web pages
- To manage databases
- To define the structure of web pages (correct)
Which tag is used to define the visible content of an HTML page?
Which tag is used to define the visible content of an HTML page?
- `body` (correct)
- `title`
- `head`
- `meta`
What does the href
attribute specify in an <a>
tag?
What does the href
attribute specify in an <a>
tag?
- The link's destination URL (correct)
- The image source
- The link's title
- The link's style
Which HTML tag is used to display an image on a web page?
Which HTML tag is used to display an image on a web page?
How do you add a comment in HTML?
How do you add a comment in HTML?
What does CSS stand for?
What does CSS stand for?
Which HTML tag is used to create an unordered list?
Which HTML tag is used to create an unordered list?
Which attribute is used to define inline styles in HTML?
Which attribute is used to define inline styles in HTML?
Which HTML element is used to define the title of a page?
Which HTML element is used to define the title of a page?
What is the purpose of the HTML form
element?
What is the purpose of the HTML form
element?
Which tag defines a paragraph in HTML?
Which tag defines a paragraph in HTML?
Which attribute is used to provide alternative text for an image?
Which attribute is used to provide alternative text for an image?
Which element is used for creating a hyperlink in HTML?
Which element is used for creating a hyperlink in HTML?
Which of the following is a semantic HTML5 element?
Which of the following is a semantic HTML5 element?
What is the purpose of the doctype
declaration in HTML?
What is the purpose of the doctype
declaration in HTML?
Which HTML element defines a table row?
Which HTML element defines a table row?
Which input type defines a single-line text input field?
Which input type defines a single-line text input field?
Which HTML element is used to embed video content?
Which HTML element is used to embed video content?
What does the id
attribute uniquely identify?
What does the id
attribute uniquely identify?
Which HTML entity represents a non-breaking space?
Which HTML entity represents a non-breaking space?
Flashcards
What is HTML?
What is HTML?
Standard markup language that describes the structure of web pages.
What is the <html>
element?
What is the <html>
element?
The root element that contains all other elements.
What is the <title>
element?
What is the <title>
element?
Specifies a title for the HTML page, shown in the browser's tab.
What is the <body>
element?
What is the <body>
element?
Signup and view all the flashcards
What are HTML elements?
What are HTML elements?
Signup and view all the flashcards
What are HTML attributes?
What are HTML attributes?
Signup and view all the flashcards
What are heading elements?
What are heading elements?
Signup and view all the flashcards
What is the <p>
element?
What is the <p>
element?
Signup and view all the flashcards
What is the <a>
element?
What is the <a>
element?
Signup and view all the flashcards
What is the src
attribute?
What is the src
attribute?
Signup and view all the flashcards
What is the style
attribute?
What is the style
attribute?
Signup and view all the flashcards
What are HTML comments?
What are HTML comments?
Signup and view all the flashcards
What is CSS?
What is CSS?
Signup and view all the flashcards
What is the <ul>
element?
What is the <ul>
element?
Signup and view all the flashcards
What is the <ol>
element?
What is the <ol>
element?
Signup and view all the flashcards
What is the <form>
element?
What is the <form>
element?
Signup and view all the flashcards
What is semantic HTML?
What is semantic HTML?
Signup and view all the flashcards
What is the <article>
element?
What is the <article>
element?
Signup and view all the flashcards
What is the <main>
element?
What is the <main>
element?
Signup and view all the flashcards
What is the <nav>
element?
What is the <nav>
element?
Signup and view all the flashcards
Study Notes
- HTML (HyperText Markup Language) is the standard markup language for creating web pages
- HTML describes the structure of a web page
- HTML consists of a series of elements
- HTML elements tell the browser how to display the content
Basic HTML Structure
- HTML documents begin with a document type declaration
<!DOCTYPE html>
- The
<html>
element is the root element of an HTML page - The
<head>
element contains meta-information about the HTML page - The
<title>
element specifies a title for the HTML page (which is shown in the browser's title bar or tab) - The
<body>
element defines the document's body, and contains the visible page content - SGML and HTML were intended for machine readability
- HTML's structure comprises a tree of nodes
- These nodes represent elements, attributes, and text
- HTML syntax involves tags enclosed in angle brackets, e.g.,
<html>
HTML Elements
- HTML elements are defined by a start tag, some content, and an end tag
- For example,
<p>This is a paragraph.</p>
- Some HTML elements have no content (empty elements)
- Empty elements are closed in the start tag (e.g.,
<br />
) or don't have an end tag - HTML elements can be nested (elements can contain other elements)
- HTML elements are case-insensitive, but it is a best practice to use lowercase tags
Common HTML Elements
<h1>
to<h6>
define headings<p>
defines a paragraph<a>
defines a hyperlink<img>
defines an image<div>
defines a section in a document<span>
defines an inline section in a document<ul>
defines an unordered list<ol>
defines an ordered list<li>
defines a list item<form>
defines an HTML form for user input<table>
defines a table<tr>
defines a table row<td>
defines a table data cell<input>
defines an input field
HTML Attributes
- HTML attributes provide additional information about HTML elements
- Attributes are always specified in the start tag
- Attributes usually come in name="value" pairs
- The
class
attribute specifies a class name for an element (used by CSS and JavaScript) - The
id
attribute specifies a unique id for an element (used by CSS and JavaScript) - The
style
attribute is used to add styles to an element, such as color, font, size, and more - The
src
attribute specifies the URL of an image (for<img>
) - The
href
attribute specifies the URL of a link (for<a>
) - The
alt
attribute specifies an alternate text for an image, if the image cannot be displayed (for<img>
) - The
title
attribute specifies extra information about an element (displayed as a tooltip)
HTML Formatting
<b>
defines bold text<strong>
defines important text (usually displayed as bold)<i>
defines italic text<em>
defines emphasized text (usually displayed as italic)<mark>
defines marked/highlighted text<small>
defines smaller text<del>
defines deleted text<ins>
defines inserted text<sub>
defines subscript text<sup>
defines superscript text
HTML Comments
- Comments are used to explain the code and can help when you edit the source code later
- Comments are ignored by browsers
- HTML comments start with
<!--
and end with-->
- For example,
<!-- This is a comment -->
HTML Styles - CSS
- CSS (Cascading Style Sheets) is used to style HTML elements
- CSS can be added inline, internally, or externally
- Inline CSS is added directly to the HTML element using the
style
attribute - Internal CSS is defined within the
<style>
element in the<head>
section - External CSS is defined in separate
.css
files - The
<link>
element is used to link to external CSS files
HTML Lists
- HTML supports ordered (numbered) and unordered (bulleted) lists
<ul>
defines an unordered list<ol>
defines an ordered list<li>
defines a list item- Ordered lists use numbers
- Unordered lists use bullets
HTML Forms
- HTML forms are used to collect user input
- The
<form>
element defines an HTML form - Input elements are used within a form to allow users to enter information
- Common input types include text, password, submit, radio, checkbox, and more
- The
<input>
element can display several types of input, depending on thetype
attribute - The
<label>
element defines a label for an input element - The
<textarea>
element defines a multi-line text input control - The
<select>
element defines a drop-down list - The
<button>
element defines a clickable button
HTML Semantics
- Semantic HTML introduces meaning to the web page rather than just presentation
- Semantic elements clearly describe their meaning to both the browser and the developer
- Examples of semantic elements:
<article>
,<aside>
,<details>
,<figcaption>
,<figure>
,<footer>
,<header>
,<main>
,<nav>
,<section>
,<summary>
- Non-semantic elements:
<div>
and<span>
(tells nothing about its content)
HTML5 Semantic Elements
<article>
represents a self-contained composition in a document, page, application, or site (e.g., a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment)<aside>
defines content aside from the page content (e.g., a sidebar)<details>
specifies additional details that the user can open and close on demand<figcaption>
defines a caption for a<figure>
element<figure>
specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.<footer>
defines a footer for a document or section<header>
defines a header for a document or section<main>
specifies the main content of a document<nav>
defines a set of navigation links<section>
defines a section in a document
HTML Media
- HTML allows embedding media such as images, audio, and video
<img>
embeds an image<audio>
embeds sound content<video>
embeds video content- The
<source>
element allows you to specify alternative video/audio files which the browser may choose from
HTML APIs
- HTML5 introduced a number of APIs (Application Programming Interfaces) that enable more advanced functionality in web applications
- Geolocation API: to get the geographical position of a user
- Drag and Drop API: to enable drag and drop functionality in web pages
- Canvas API: for drawing graphics on the fly
- SVG (Scalable Vector Graphics) API: for creating vector-based graphics
- Web Storage API: to store data locally within the user's browser
HTML Character Entities
- HTML entities are used to display reserved characters (which have special meaning in HTML) and characters that are not easily typed on a keyboard
- An HTML entity starts with an ampersand
&
and ends with a semicolon;
- Common entities:
<
(less than),>
(greater than),&
(ampersand),
(non-breaking space) - Accented characters and symbols can also be represented by entities (e.g.,
é
for é)
HTML Doctype
- The
<!DOCTYPE>
declaration defines the document type - It must be the very first thing in the HTML document, before the
<html>
tag - For HTML5, the doctype is simple:
<!DOCTYPE html>
- HTML 4.01 had more complex doctype declarations, referencing DTDs (Document Type Definitions)
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.