HTML Flashcards

1
Q

Where do you put non-visible content about the HTML document?

A

head holds information about the page, holds the metadata

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where do you put visible content about the HTML document?

A

body holds what will be displayed on the page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Where do the head and body tags go in a valid HTML document?

A

Within the html element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the purpose of a !DOCTYPE declaration?

A

Tells the browser what sort of document it will be encountering (HTML 4 or 5, XHTML, XML, etc.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Give five examples of HTML element types.

A

head, body, p, img, h1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the purpose of HTML attributes?

A

They give additional information about the element that they are on

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Give an example of an HTML entity (escape character).

A

< 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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do block-level elements affect the document flow?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do inline elements affect the document flow?

A

Inline elements will affect the text in the line, not creating a new line for a new block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the default width and height of a block-level element?

A

Takes up the full width available (100%). Default height is that of the content (auto).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the default width and height of an inline element?

A

Only takes up as much width as necessary (auto). The height is that of the content (exactly) (auto).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the difference between an ordered list and an unordered list in HTML?

A

Browsers will display ordered list with a progression (1, 2, 3, …) while unordered lists will be shown with just bullets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Is an HTML list a block element or an inline element?

A

HTML lists are block elements (ol, ul, and li)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What HTML tag is used to link to another website?

A

Anchor tag a href=””

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is an absolute URL?

A

Has enough information to get to the desired page

Starts with a domain name, followed by a path to the page/file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a relative URL?

A

Refers to a file relative to the current file/document, traversing a folder structure
Domain name can be omitted through this way

17
Q

When should tags b and i be used instead of strong or em?

A

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.

18
Q

How do you indicate the relative link to a parent directory?

A

Use ../ to indicate going up a directory to the parent

19
Q

How do you indicate the relative link to a child directory?

A

Simply start with the name of the child like child_dir/child_dir_file.png

20
Q

How do you indicate the relative link to a grand parent directory?

A

Double up on the parent directory method, ../../

21
Q

How do you indicate the relative link to the same directory?

A

Simply indicate the file you want to access, file_in_same_folder.png

22
Q

What is the purpose of an HTML “form” element?

A

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)

23
Q

Give five examples of form control elements

A

input, select, option, textarea, button

24
Q

Give three examples of “type” attribute values for HTML “input” elements

A

text, radio, checkbox, password, submit, image, file

25
Q

Is an HTML”input”element a block element or an inline element?

A

inline element

26
Q

When do you we use a “label” or a “p”/”div” to put text in front of an input?

A

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

27
Q

What are the six primary HTML elements for creating tables?

A

table, thead, tbody, tr, th, td (tfoot sometimes)

28
Q

What purpose do the thead and tbody elements serve?

A

thead indicates the header of the table, holding the columns

tbody indicates the body of the table

29
Q

Give two examples of data that would lend itself well to being displayed in a table.

A

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

30
Q

What is a client?

A

A computer or application that sends requests to and receives responses from a server

31
Q

What is a server?

A

A computer or application that listens for requests from and sends reponses to clients

32
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

GET

33
Q

What three things are on the start-line of an HTTPrequestmessage?

A
  • An HTTP method, such as GET or POST (can also be PUT, 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
34
Q

What three things are on the start-line of an HTTPresponsemessage?

A

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, or 200
  • The status text, which is a human readable message about the status code (Not Found, Forbidden, etc.)
35
Q

What are HTTP headers?

A

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

36
Q

Where would you go if you wanted to learn more about a specific HTTP Header?

A

MDN has documentation on specific headers, list can be found here

37
Q

Is a body required for a valid HTTP request or response message?

A

No, it’s optional