HTML Flashcards
Where do you put non-visible content about the HTML document?
head holds information about the page, holds the metadata
Where do you put visible content about the HTML document?
body holds what will be displayed on the page
Where do the head and body tags go in a valid HTML document?
Within the html element
What is the purpose of a !DOCTYPE declaration?
Tells the browser what sort of document it will be encountering (HTML 4 or 5, XHTML, XML, etc.)
Give five examples of HTML element types.
head, body, p, img, h1
What is the purpose of HTML attributes?
They give additional information about the element that they are on
Give an example of an HTML entity (escape character).
< and the copyright symbol (©
, & copy ;) are both HTML entities (also called escape characters). They will always have ampersand and semicolon (not required but should be there)
How do block-level elements affect the document flow?
Block-level elements appear on a separate line (they are a block)
- Elements after block-level elements will be on a new line because the block takes up the whole width of the line, leaving no room for the next element
How do inline elements affect the document flow?
Inline elements will affect the text in the line, not creating a new line for a new block
What are the default width and height of a block-level element?
Takes up the full width available (100%). Default height is that of the content (auto).
What are the default width and height of an inline element?
Only takes up as much width as necessary (auto). The height is that of the content (exactly) (auto).
What is the difference between an ordered list and an unordered list in HTML?
Browsers will display ordered list with a progression (1, 2, 3, …) while unordered lists will be shown with just bullets
Is an HTML list a block element or an inline element?
HTML lists are block elements (ol, ul, and li)
What HTML tag is used to link to another website?
Anchor tag a href=””
What is an absolute URL?
Has enough information to get to the desired page
Starts with a domain name, followed by a path to the page/file
What is a relative URL?
Refers to a file relative to the current file/document, traversing a folder structure
Domain name can be omitted through this way
When should tags b and i be used instead of strong or em?
b and i should only be used when the text needs to be bolded or italicized (such as with song titles, movie titles) but not for emphasis. Those should use the strong or em tags.
How do you indicate the relative link to a parent directory?
Use ../ to indicate going up a directory to the parent
How do you indicate the relative link to a child directory?
Simply start with the name of the child like child_dir/child_dir_file.png
How do you indicate the relative link to a grand parent directory?
Double up on the parent directory method, ../../
How do you indicate the relative link to the same directory?
Simply indicate the file you want to access, file_in_same_folder.png
What is the purpose of an HTML “form” element?
Holds the form control elements
! Not the same as allowing users to interact with a page and submit information (which is what a form does, but not the “form” element)
Give five examples of form control elements
input, select, option, textarea, button
Give three examples of “type” attribute values for HTML “input” elements
text, radio, checkbox, password, submit, image, file
Is an HTML”input”element a block element or an inline element?
inline element
When do you we use a “label” or a “p”/”div” to put text in front of an input?
Labels should be specific to an “input” by the input’s “id” attribute
Use a “p” if it’s referring to a group of “input”s
Use div to create a new block element
What are the six primary HTML elements for creating tables?
table, thead, tbody, tr, th, td (tfoot sometimes)
What purpose do the thead and tbody elements serve?
thead indicates the header of the table, holding the columns
tbody indicates the body of the table
Give two examples of data that would lend itself well to being displayed in a table.
Tabular Data
A list of product and their prices
A list of specifications and their values for a product
A list of students and their grades
What is a client?
A computer or application that sends requests to and receives responses from a server
What is a server?
A computer or application that listens for requests from and sends reponses to clients
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
What three things are on the start-line of an HTTPrequestmessage?
- An HTTP method, such as
GET
orPOST
(can also bePUT
,HEAD
,OPTIONS
, possibly more) - A request target, which is usually a URL
- The HTTP version which defines what the rest of the message will look like
What three things are on the start-line of an HTTPresponsemessage?
Note: the “start line” of an HTTP response is also known as the “status line”
- The protocol version (usually
HTTP/1.1
) - The status code, like
404
,403
, or200
- The status text, which is a human readable message about the status code (
Not Found
,Forbidden
, etc.)
What are HTTP headers?
HTTP headers come after the start line and before the empty line + body of HTTP requests and responses
They hold additional information about a request/response being sent from a client/server
There are many groups that headers can be categorized into, like general headers, request and response headers, representation headers, and more
Where would you go if you wanted to learn more about a specific HTTP Header?
MDN has documentation on specific headers, list can be found here
Is a body required for a valid HTTP request or response message?
No, it’s optional