HTML Flashcards
What does HTML stand for?
HyperText Markup Language
What is a markup language?
a computer language that defines the structure and presentation of raw text
What is HyperText?
text displayed on a computer or device that provides access to other text through links, also known as hyperlinks
What is HTML composed of?
Elements
What is the HTML element for paragraph?
<p> (opening tag)
| </p>
(closing tag)
What is an HTML element made of?
a tag and content
How is HTML organised in relationships?
as a collection of family tree relationships
What is an element called when it is contained within another element?
The child of that element, and the child element is nested inside the parent element
The child element is ____ inside the parent element?
Nested
What is the relationship between elements and their ancestor and descendent elements known as?
Hierarchy
What are elements at the same level called?
Siblings
How many headings / heading elements are there in HTML?
6
What are the 6 headings in HTML?
< h1 > — used for main headings. All other smaller headings are used for subheadings
< h2 > < h3 > < h4 >< h5 > < h6 >
What are the 6 headings in HTML?
<h1> — used for main headings. All other smaller headings are used for subheadings
</h1>
<h2></h2>
<h3></h3>
<h4></h4>
<h5></h5>
<h6></h6>
Why is <div> useful?</div>
It it useful for grouping elements together
What is the < div > element short for, and what does it do?
<div> is short for division and a <div> contains or divides the page into sections</div></div>
Do <div>s have a visual representation?</div>
No
How do <div>s help with style?</div>
<div>s allow you to group HTML elements to apply the same styles for all HTML elements inside</div>
How do you ensure readability with <div>s?</div>
Add two spaces of indentation
What is an attribute?
Attributes are content added to the opening tag of an element
What two parts are attributes made up of?
the name of the attribute
the value of the attribute
What does the id attribute do?
specify different content
come back to add more
What do attributes do?
Attributes can be added to the opening tag of an HTML element to change its default behavior or provide additional data about it
What do attributes consist of?
Attributes consist of a name and a value in the format name=”value”:
How do you display text in HTML?
with a paragraph < p > or a span < span >
What is <span> used for?</span>
<span> are used to separate small pieces of content that are on the same line as other content</span>
When is it best to use < span > < /span > ?
when you want to target a specific piece of content that is inline, or on the same line as other text
(use < div > when want to divide your content into blocks)
What HTML tag emphasises text?
< em >
What HTML tag highlights important text?
< strong >
How is < em > usually manifested in a browser?
in italics
How is < strong > usually manifested in a browser?
in bold
Does the spacing between code in an HTML file affect the positioning of elements in the browser?
No
How do you modify spacing of your code in the browser?
Use HTML line break element - < br >
What is unique about < br >
it is only composed of a starting tag (no closing tag - < /br > does NOT exist)
What is the HTML tag for an unordered list?
<ul> </ul>
What tag must be used with the unordered list < ul > < /ul> ?
the list item tag < li >
What is different about ordered lists <ol> compared to unordered lists </ol><ul>?</ul>
Ordered lists are numbered
What tag do you use to add images?
< img >
What is the closing tag for <img></img>?
Trick question, <img></img> is a self-closing tag - the end of the <img></img> tag has a forward slash <img></img>, but not always
What is <img></img>’s required attribute?
src
What is src, <img></img>’s required attribute?
the image source
<img></img>
What does URL stand for?
uniform resource locator (URL)
What does the alt attribute mean?
alternative text
How do you use the alt attribute with <img></img>
the alt attribute can be added to the image tag just like the src attribute, and the value of alt should be a description of the image:
<img></img>
Give 3 purposes of the alt attribute
- If an image fails to load on a web page, a user can mouse over the area originally intended for the image and read a brief description of the image. This is made possible by the description you provide in the alt attribute.
- Visually impaired users often browse the web with the aid of screen reading software. When you include the alt attribute, the screen reading software can read the image’s description out loud to the visually impaired user.
- The alt attribute also plays a role in Search Engine Optimization (SEO), because search engines cannot “see” the images on websites as they crawl the internet. Having descriptive alt attributes can improve the ranking of your site.
When should you not use the alt attribute?
When the image on the web page is not one that conveys any meaningful information to a user
What is the element for videos in HTML?
< video >
How does the < video > element differ from the < img > element?
The < video > element requires a closing tag - < /video >
How do you tell the browser to include basic video controls?
with the controls attribute
What is this: < !DOCTYPE html >
document type declaration
Why do we need to write a document type declaration with HTML?
to let web browsers know that we are using HTML
How do you save HTML code as a file?
with the .html file extension
What is the < html > element?
html
What does the < head > element contain?
metadata for a web page
what is metadata in HTML?
Metadata is information about the page that isn’t displayed directly on the web page
What does a browser’s tab display?
what’s written inside the < title > element
Where does the < title > tag go?
always inside the < head >, as metadata
How do you link to other web pages?
using the anchor element - < a >
What is needed to complete the anchor - < a > - element?
an href attribute
what does href stand for?
hyperlink reference
What does the target attribute do?
specifies how a link should open
what is needed for a link to open in a new window?
the target attribute requires a value of _blank
in multi-page static websites, where are HTML files stored?
in the root directory / a main folder where all the html files are stored
What is a relative path?
A relative path is a filename that shows the path to a local file - a file on the same website (such as ./index.html) - versus an absolute path (a full URL).
The ./ in ./index.html tells the browser to look for the file in the current folder.
How do you turn an image < img > into a link?
by wrapping the < img > element with the anchor < a > element
eg:
<a><img></img></a>
what tools are available to visualise relationships between elements?
whitespace and indentation
Why is whitespace useful?
because space in the code doesn’t translate to space in the body of the web page
How does the World Wide Web Consortium suggest creating indentation in your code?
With two spaces