HTML Flashcards
Where do you put non-visible content about the HTML document?
in the head
Where do you put visible content about the HTML document?
in the body
Where do the head and body tags go in a valid HTML document?
- head is the first thing that comes after the html tag
- body goes after the head
What is the purpose of a !DOCTYPE declaration?
lets the browser know what version of HTML the page is written in
Give five examples of HTML element tags.
head, body, p, h1, h2, h3
What is the purpose of HTML attributes?
changes or adds more information to the html element
Give an example of an HTML entity (escape character).
< > & ‘’”” copyright, trademark, etc.
How do block-level elements affect the document flow?
takes up 100% width (the whole line)
How do inline elements affect the document flow?
takes up however much horizontal space it takes
What are the default width and height of a block-level element?
- width 100%
- height: auto (however much vertical space it takes)
What are the default width and height of an inline element?
- width: auto (however much horizontal space it takes)
- height: auto (however much vertical space it takes)
What is the difference between an ordered list and an unordered list in HTML?
- ordered list is numbered
- unordered list uses bullet points
Is an HTML list a block element or an inline element?
-block
What HTML tag is used to link to another website?
<a></a>
What is an absolute URL?
the full page address of a webpage or web file
What is a relative URL?
uses a file path to link to a file in the same relative location as the root file
How do you indicate the relative link to a parent directory?
../parent.html
How do you indicate the relative link to a child directory?
child-folder/child.html
How do you indicate the relative link to a grand parent directory?
../../grandparent.html
How do you indicate the relative link to the same directory?
file-name.html
What is the purpose of an HTML form element?
sets up the boundary that allows the user to submit data to the server
Give five examples of form control elements.
text/password input, text area, radio/submit button, select, option, file upload, drop-down boxes
Give three examples of type attributes for HTML “input” elements.
text, password, radio, checkbox, file, submit, image, hidden
Is an HTML “input” element a block element or an inline element?
inline element
What is the difference between the “get” method and the “post” method when taking in values from a form?
- get: values from the form are added to the end of the URL specified in the “action” attribute. mainly used for short forms (search boxes)
- post: values are sent in HTTP headers. used to allow users to upload a file, or if the form is very long/contains sensitive data/adds or deletes information from a database
What are the six primary HTML elements for creating tables?
td, tr, th, thead, tbody, tfoot
What purpose do the thead and tbody elements serve?
- semantic descriptor
- apply different stylistic elements
- assist screen readers
- in some browsers, thead elements stay visible while the tbody elements scroll
Give two examples of data that would lend itself well to being displayed in a table.
financial data, TV schedules, sports results, stock reports, timetables
What is a client?
a computer or program that accesses a service made available by a “server”
What is a server?
a computer or program that provides functionality for “clients”
Which HTTP method does a browser issue to a web server when you visit a URL?
HTTP GET request
What three things are on the start-line of an HTTP request message?
- an HTTP method, a verb (GET/PUT/POST), or a noun (HEAD/OPTIONS) that describes the action to be performed
- the request target, usually a URL
- the HTTP version
ex. GET https://example.com/ HTTP/1.1
What three things are on the start-line of an HTTP response message?
- the protocol version (usually HTTP/1.1)
- a status code that indicates success or failure (202, 404, 302, …)
- a status text that explains the status code
What are HTTP headers?
- all the text from a HTTP request/response that comes after the request line
- (kind of like the header in an html document)
Is a body required for a valid HTTP request or response message?
-no, some methods don’t have a response body (HEAD)
or when the response is just 404 Not Found
What is AJAX?
a technique for loading data into part of a page without having to refresh the entire page
What does the AJAX acronym stand for?
Asynchronous JavaScript And XML
Which object is built into the browser for making HTTP requests in JavaScript?
XHR object
What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?
load event
An XMLHttpRequest object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?
they both share an object in the prototypal chain