3. More HTML Flashcards

1
Q

A(n) ____ is any element in a web document body that has opening and closing tags. Web developers typically create many of these as a convenience to assist in organizing and formatting content.

A

container

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

A ____ container is the container in which another element resides.

A

parent

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

What are examples of common HTML containers?

A

<header>
<footer>
<address>
<main>
<section>
<article>
<nav>
<aside>
<div>
<span>

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

A(n) ____ element fills the width of the element’s parent container and can contain other block elements, inline elements, and text

A

block

Some block elements, like <p>, can’t be contained within other block elements, like <p>, in this example, because it creates ambiguity

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

Which HTML element is the only block element that has no semantic meaning?

A

<div>

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

A(n) ____ element fills the minimum space possible in the element’s parent container and can only contain text or other inline elements

A

inline

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

Which inline element has no semantic meaning?

A

<span>

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

Which HTML element allows the web browser to submit information from the user to the server?

A

<form></form>

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

What are the two primary attributes of the <form> element?

A
  1. action - indicates the URL where the form data should be sent
  2. method - indicates the HTTP request type the browser will use to communicate with the server. The method is either GET or POST
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When the method attribute in a <form> element is not set or is invalid, the browser by default uses an HTTP ____ request to communicate with the server.

A

GET

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

When a browser submits information to a server using an HTTP GET request, it alters the URL of the HTTP request by adding a ____ character followed by a ____ string. This string is composed of key-value pairs separated by the ____ character.

A

?, query, &

Example:
https://example.com/apply?first=Rick&last=Deckard

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

The HTTP POST method sends a query string in the request ____ rather than in the URL.

A

body

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

If sending an image through a POST request, the <form> element’s ____ attribute and the value ____ indicates the web browser should split a POST request into multiple parts, where each input field is sent as a separate part of the HTTP request message.

A

enctype, multipart/form-data

Example:
<form action=”https://example.com/apply” method=”POST” enctype=”multipart/form-data”>

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

User-entered special characters, like &, ?, and =, along with whitespace characters, must be ____

A

escaped

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

What is the escape character for a space in a query string?

A

The plus symbol (+)

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

How are other, non-space, special characters represented in a query string?

A

%XX, where XX is the ASCII hex value of the character

If “1 + 2 = ?” is entered into a textbox, the browser escapes the values producing “1+%2B+2+%3D+%3F”. 2B is the ASCII hex value for “+”, 3D is the ASCII value for “=”, and 3F is the ASCII value for “?”

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

A(n) ____ is an interactive component (usually graphical) that the browser uses to interact with a user.

A

widget

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

What element allows users to enter information into a web page?

A

<input> (a void element)

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

What are the five primary attributes that the <input> element can have?

A

type – the widget type. Common types include text, password, submit, and button

name – names the widget and sends the widget’s value when the widget’s form is submitted

id – used to give a widget a unique identifier. Often the id and name attributes are the same. However, the id attribute may be different from the name attribute. Ex: The same webpage may have two forms that send data using the same name.

placeholder –specifies text that first appears in a text widget, typically for giving the user a hint as to the expected value

value – specifies a default value for a widget

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

The ____ element displays descriptive text associated with a specific widget.

A

<label></label>

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

A label has a ____ attribute whose value should match the id attribute for the widget being labeled

A

for

Labels help people using screen readers understand what input is expected.

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

The ____ element allows users to enter multiple lines of text.

A

<textarea></textarea>

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

What are the two optional attributes for the <textarea> element that specify the initial size of the text area?

A

rows, cols

Example:

<textarea>To summarize...</textarea>

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

A checkbox will initially appear selected if the ____ attribute is set

A

checked

Example:
<input type=”checkbox” checked>

25
Q

The “checked” attribute is an example of a ____ attribute, which requires no value and is true if present, false if absent

A

boolean

26
Q

A(n) ____ is a widget for input elements with the type attribute of “____”, which allows users to select exactly one value from possibly many values

A

radio button, radio

27
Q

When submitting a form, the browser sends the selected radio button’s ____ and ____ attribute

A

name, value

Example:
If the radio button <input type=”radio” name=”movie” value=”ET”> is selected, “movie=ET” is sent to the server.

28
Q

Which HTML element creates a drop-down menu, which allows users to select one of several predefined values?

A

<select></select>

29
Q

Which HTML element creates a value the user can select within a drop-down menu?

A

<option></option>

The “value” attribute of this element sets the value that displays in the drop-down menu

30
Q

A ____ widget is created by specifying a “size” attribute in the <select> element?

A

list box

Example:
<select size=”4”> creates a list box that shows four options at a time. If the list box contains more than size options, the browser adds a vertical scrollbar so the user can scroll through the list of options.

31
Q

Which attribute, when added to the <select> element, allows users to select more than one option?

A

multiple

Example:
<select name=”flagcolors” size=”4” multiple>

32
Q

In what two ways can a button be created with HTML?

A
  1. adding a “button” value to the “type” attribute in the <input> element
  2. Using the <button> element
33
Q

What is the main difference between declaring a button with <input type=”button”> and with <button> ?

A

The button element allows for displaying text and images in a button, whereas the button attribute in the input element only allows for displaying text in a button

34
Q

What values can the <button> element’s “type” attribute be set to?

A

“button” or “submit”

The “button” value is usually used with JavaScript to execute an action when the button is clicked

The “submit” value creates a submit button for a form

35
Q

Which value, used either with the “password” or “text” value of the “type” attribute can restrict the number of characters that a user can enter

A

maxLength

** The “size” attribute can also limit a password field or text box’s width

36
Q

The element groups related form widgets together and draws a box around the related widgets

A

<fieldset></fieldset>

37
Q

Which element defines a caption for a <fieldset> element?

A

<legend></legend>

38
Q

What HTML element and attribute create a date picker?

A

<input type=”date”>

39
Q

What two attributes can establish the early and late bounds of a date picker?

A

min and max

40
Q

What HTML element and attribute create a color picker?

A

<input type=”color”>

41
Q

What HTML element and attribute ensure that the input is a valid number?

A

<input type=”number”>

The “min” and “max” attributes are often used with the number input.

42
Q

What HTML element and attribute create a slider?

A

<input type=”range”>

Often uses “min,” “max,” and “value” attributes

43
Q

How do you create a combo box in HTML?

A

<input list=”sport”>

<datalist id=”sport”>
<option value=”Baseball”>
<option value=”Basketball”>
<option value=”Football”>
<option value=”Hockey”>
<option value=”Soccer”>
</datalist>

44
Q

What are the four specialized text fields that can be created with the “type” attribute of the <input> element?

A

type=”url”
type=”tel”
type=”email”
type=”search” (for typing search terms)

45
Q

What are various <input> attributes that can be used to validate form data?

A

maxlength
minlength
max
min
pattern (provides a regex that the input must match)
required
step (sets the amount by which the value can change)

46
Q

A(n) ____ is a mechanism that allows a webpage element to function correctly even if the browser does not support a particular element.

A

fallback

47
Q

A(n) ____ is a fallback using JavaScript code that makes certain HTML features (Ex: the date picker) work on browsers that do not natively support those features.

A

polyfill

48
Q

Which HTML element is used to play a sound file in a web page?

A

<audio></audio>

49
Q

Which HTML element is placed inside the <audio> element or the <video> element to specify an audio or video file to play?

A

<source></source>

50
Q

What are some common attributes of the <audio> element?

A

autoplay
controls (displays audio controls)
loop
muted (initially mutes the sound)

51
Q

Which audio formats have the widest browser support?

A

AAC (Advanced Audio Coding)
MP3

52
Q

Which HTML element is used to display video in a webpage?

A

<video></video>

53
Q

What are three common video formats?

A

MPEG-4 or MP4 (.m4a [audio only] or .mp4 [may contain video])

Ogg Theora (.ogg, .ogv, .ogm)

WebM (.webm)

54
Q

What HTML element is used to display a YouTube video in a web page?

A

<iframe></iframe>

This element allows a webpage to be embedded in a rectangular area of the current webpage

The “src” attribute specifies the URL of the webpage to display and the “width” and “height” attributes to define the width and height in pixels of the rectangular iframe

55
Q

Which HTML element allows a webpage to include executable code, which the browser assumes to be JavaScript unless indicated otherwise?

A

<script></script>

56
Q

Which HTML element allows the webpage to introduce presentational directives, usually CSS.

A

<style></style>

57
Q

What element should the <style> element be placed inside?

A

The <head> element, since the stylesheet describes the presentation of the entire document.

58
Q

True or false: developers should use self-closing tags (e.g., <br />) for void elements.

A

False

Use <br> instead of <br />