Questions and Answers
What is the purpose of the <!DOCTYPE html>
declaration in an HTML document?
Which of the following elements is used to create a clickable hyperlink?
When defining an image in HTML, what attribute is used to specify the file destination?
What does the alt
attribute in an image tag provide?
Signup and view all the answers
Which HTML element would you use to create a numbered list?
Signup and view all the answers
What is the purpose of comments in HTML?
Signup and view all the answers
Which tag is used to define a paragraph in HTML?
Signup and view all the answers
What does the target
attribute in an anchor tag specify?
Signup and view all the answers
Study Notes
HTML Basics
-
HTML Definition: Hypertext Markup Language is the standard language for creating web pages.
-
Structure of HTML Document:
-
Doctype Declaration:
<!DOCTYPE html>
- indicates the document type and version. -
HTML Element:
<html>
- root element that contains all other elements. -
Head Element:
<head>
- contains meta-information, links to stylesheets, scripts, and the title. -
Body Element:
<body>
- contains the content of the web page, such as text, images, and links.
-
Doctype Declaration:
-
Basic Syntax:
- HTML elements consist of tags, which are enclosed in angle brackets (e.g.,
<tagname>
). - Most elements have an opening tag and a corresponding closing tag (e.g.,
<tagname></tagname>
).
- HTML elements consist of tags, which are enclosed in angle brackets (e.g.,
-
Attributes:
- Provide additional information about elements.
- Syntax:
<element attribute="value">
. - Common attributes:
id
,class
,style
,src
,href
.
-
Comments:
- Used to leave notes in the code, not displayed in the browser.
- Syntax:
<!-- Comment here -->
.
-
Text Formatting Elements:
-
<h1>
to<h6>
: Headings (h1 is the largest, h6 is the smallest). -
<p>
: Paragraph. -
<strong>
: Bold text. -
<em>
: Italicized text.
-
-
Lists:
-
Ordered List:
<ol>
- numbered list. -
Unordered List:
<ul>
- bullet list. -
List Item:
<li>
- defines a list item.
-
Ordered List:
-
Links (Hyperlinks):
- Defined using the
<a>
tag (anchor tag). -
Syntax:
<a href="URL">Link Text</a>
.-
href
: specifies the URL the link points to. -
target
: can specify how to open the link (e.g.,_blank
for new tab).
-
- Defined using the
-
Images:
- Added using the
<img>
tag. -
Syntax:
<img src="imageURL" alt="description">
.-
src
: the source of the image file. -
alt
: alternative text for the image.
-
- Added using the
-
Forms:
-
<form>
: used to collect user input. - Common elements include
<input>
,<textarea>
,<select>
, and<button>
.
-
HTML Overview
- HTML: Stands for Hypertext Markup Language; it's the standard markup language for web page creation.
Structure of HTML Document
-
Doctype Declaration:
<!DOCTYPE html>
signifies the document type and version of HTML being used. -
HTML Element: The root element is
<html>
, which encapsulates all other elements in the document. -
Head Element:
<head>
includes meta-information about the document, like<title>
, links to stylesheets and scripts. -
Body Element:
<body>
contains the actual content of the webpage such as text, images, and links.
Basic Syntax
- HTML elements consist of tags wrapped in angle brackets (e.g.,
<tag>
). - Most elements have an opening and a closing tag (e.g.,
<tag>
...</tag>
), forming a structure. -
Attributes: Offer additional details about elements, formatted as
attribute="value"
. - Common attributes include
id
,class
,style
,src
, andhref
.
Comments
- Used for leaving notes within the code for developers; not shown in the browser.
- Syntax for comments is
<!-- Comment here -->
.
Text Formatting Elements
- Headings: Created using
<h1>
to<h6>
, where<h1>
is the largest and<h6>
is the smallest. - Paragraph: Defined using
<p>
. - Text styles include
<strong>
for bold and<em>
for italicized text.
Lists
-
Ordered List: Created using
<ol>
, produces a numbered list. -
Unordered List: Created using
<ul>
, produces a bulleted list. -
List Item: Defined with
<li>
within either list type.
Links (Hyperlinks)
- Formed using
<a>
(anchor tag). - Syntax:
<a href="URL">Link Text</a>
. - The
href
attribute specifies the target URL, whiletarget
can control link opening behavior (e.g.,_blank
opens in a new tab).
Images
- Included with the
<img>
tag. - Syntax:
<img src="imageURL" alt="description">
. - The
src
attribute denotes the source file, whilealt
provides alternative text for the image.
Forms
-
<form>
: Utilized for collecting user input. - Common form elements include
<input>
,<textarea>
,<select>
, and<button>
.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Test your knowledge on the fundamentals of HTML, including its structure, basic syntax, and commonly used attributes. This quiz will cover the essential elements that form the backbone of web pages and web development. Perfect for beginners looking to solidify their understanding of HTML.