3. More HTML Flashcards
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.
container
A ____ container is the container in which another element resides.
parent
What are examples of common HTML containers?
<header>
<footer>
<address>
<main>
<section>
<article>
<nav>
<aside>
<div>
<span>
A(n) ____ element fills the width of the element’s parent container and can contain other block elements, inline elements, and text
block
Some block elements, like <p>, can’t be contained within other block elements, like <p>, in this example, because it creates ambiguity
Which HTML element is the only block element that has no semantic meaning?
<div>
A(n) ____ element fills the minimum space possible in the element’s parent container and can only contain text or other inline elements
inline
Which inline element has no semantic meaning?
<span>
Which HTML element allows the web browser to submit information from the user to the server?
<form></form>
What are the two primary attributes of the <form> element?
- action - indicates the URL where the form data should be sent
- method - indicates the HTTP request type the browser will use to communicate with the server. The method is either GET or POST
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.
GET
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.
?, query, &
Example:
https://example.com/apply?first=Rick&last=Deckard
The HTTP POST method sends a query string in the request ____ rather than in the URL.
body
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.
enctype, multipart/form-data
Example:
<form action=”https://example.com/apply” method=”POST” enctype=”multipart/form-data”>
User-entered special characters, like &, ?, and =, along with whitespace characters, must be ____
escaped
What is the escape character for a space in a query string?
The plus symbol (+)
How are other, non-space, special characters represented in a query string?
%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 “?”
A(n) ____ is an interactive component (usually graphical) that the browser uses to interact with a user.
widget
What element allows users to enter information into a web page?
<input> (a void element)
What are the five primary attributes that the <input> element can have?
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
The ____ element displays descriptive text associated with a specific widget.
<label></label>
A label has a ____ attribute whose value should match the id attribute for the widget being labeled
for
Labels help people using screen readers understand what input is expected.
The ____ element allows users to enter multiple lines of text.
<textarea></textarea>
What are the two optional attributes for the <textarea> element that specify the initial size of the text area?
rows, cols
Example:
<textarea>To summarize...</textarea>