FE1: Web Development Fundamentals Flashcards
Elements and Structure
< li > List Item Element
The <li> list item element create list items inside:
- Ordered lists <ol>
- Unordered lists <ul>
Elements and Structure
<video> Video Element
The <video> element embeds a media player for video playback. The src attribute will contain the URL to the video. Adding the controls attribute will display video controls in the media player.</video>
Note: The content inside the opening and closing tag is shown as a fallback in browsers that don’t support the element.
Elements and Structure
Emphasis Element
The <em> emphasis element emphasizes text and browsers will usually italicize the emphasized text by default.</em>
斜体
Elements and Structure
Attribute Name and Values
HTML attributes consist of a name and a value using the following syntax: name=”value” and can be added to the opening tag of an HTML element to configure or change the behavior of the element.
Elements and Structure
Line Break Element
The <br></br> line break element will create a line break in text and is especially useful where a division of text is required, like in a postal address. The line break element requires only an opening tag and must not have a closing tag.
Elements and Structure
Unique ID Attributes
In HTML, specific and unique id attributes can be assigned to different elements in order to differentiate between them.
When needed, the id value can be called upon by CSS and JavaScript to manipulate, format, and perform specific instructions on that element and that element only. Valid id attributes should begin with a letter and should only contain letters (a-Z), digits (0-9), hyphens (-), underscores (_), and periods (.).
Elements and Structure
HTML Attributes
HTML attributes are values added to the opening tag of an element to configure the element or change the element’s default behavior. In the provided example, we are giving the <p> (paragraph) element a unique identifier using the id attribute and changing the color of the default text using the style attribute.
Elements and Structure
alt Attribute
An <img></img> element can have alternative text via the alt attribute. The alternative text will be displayed if an image fails to render due to an incorrect URL, if the image format is not supported by the browser, if the image is blocked from being displayed, or if the image has not been received from the URL.
The text will be read aloud if screen reading software is used and helps support visually impaired users by providing a text descriptor for the image content on a webpage.
Elements and Structure
<span> Span Element</span>
The <span> element is an inline container for text and can be used to group text for styling purposes. However, as <span> is a generic container to separate pieces of text from a larger body of text, its use should be avoided if a more semantic element is available.</span></span>
Elements and Structure
<strong> Strong Element</strong>
Elements and Structure
<a> Anchor Element</a>
The <a> anchor element is used to create hyperlinks in an HTML document. The hyperlinks can point to other webpages, files on the same server, a location on the same page, or any other URL via the hyperlink reference attribute, href. The href determines the location the anchor element points to.</a>
Elements and Structure
Target Attribute
The target attribute on an <a> anchor element specifies where a hyperlink should be opened. A target value of “_blank” will tell the browser to open the hyperlink in a new tab in modern browsers, or in a new window in older browsers or if the browser has had settings changed to open hyperlinks in a new window.</a>
Elements and Structure
Link to a Different Part of the Page #
The anchor element <a> can create hyperlinks to different parts of the same HTML document using the href attribute to point to the desired location with # followed by the id of the element to link to.</a>
HTML
Comments
In HTML, comments can be added between an opening <!-- and closing -->. Content inside of comments will not be rendered by browsers, and are usually used to describe a part of code or provide other details.
Comments can span single or multiple lines.
Elements and Structure
Whitespace
Whitespace, such as line breaks, added to an HTML document between block-level elements will generally be ignored by the browser and are not added to increase spacing on the rendered HTML page. Rather, whitespace is added for organization and easier reading of the HTML document itself.
Elements and Structure
Title Element
The <title> element contains a text that defines the title of an HTML document. The title is displayed in the browser’s title bar or tab in which the HTML page is displayed. The <title> element can only be contained inside a document’s <head> element.</title></title>
Elements and Structure
Document Type Declaration
The document type declaration <!DOCTYPE html> is required as the first line of an HTML document. The doctype declaration is an instruction to the browser about what type of document to expect and which version of HTML is being used, in this case it’s HTML5.
<!DOCTYPE html>
Tables
Table Row Element
The table row element, <tr>, is used to add rows to a table before adding table data and table headings.
Tables
Table Data Element
The table data element, <td>, can be nested inside a table row element, <tr>, to add a cell of data to a table.
Tables
Table Head Element
The table head element, <thead>, defines the headings of table columns encapsulated in table rows.
Tables
rowspan Attribute
Similar to colspan, the rowspan attribute on a table header or table data element indicates how many rows that particular cell should span within the table. The rowspan value is set to 1 by default and will take any positive integer up to 65534.
Tables
Table Body Element
The table body element, <tbody>, is a semantic element that will contain all table data other than table heading and table footer content. If used, <tbody> will contain all table row <tr> elements, and indicates that <tr> elements make up the body of the table. <table> cannot have both <tbody> and <tr> as direct children.
Tables
Table Body Element
The table body element, <tbody>, is a semantic element that will contain all table data other than table heading and table footer content. If used, <tbody> will contain all table row <tr> elements, and indicates that <tr> elements make up the body of the table. <table> cannot have both <tbody> and <tr> as direct children.
Tables
Table Heading Element
The table heading element, <th>, is used to add titles to rows and columns of a table and must be enclosed in a table row element, <tr>.
Tables
colspan Attribute
The colspan attribute on a table header <th> or table data <td> element indicates how many columns that particular cell should span within the table. The colspan value is set to 1 by default and will take any positive integer between 1 and 1000.
Tables
<tfoot> Table Footer Element
</tfoot>
The table footer element, <tfoot>, uses table rows to give footer content or to summarize content at the end of a table.
Forms
<input></input>: Checkbox Type
When using an HTML input element, the type=”checkbox” attribute will render a single checkbox item. To create a group of checkboxes related to the same topic, they should all use the same name attribute. Since it’s a checkbox, multiple checkboxes can be selected for the same topic.
Forms
textarea Element
The textarea element is used when creating a text-box for multi-line input (e.g. a comment section). The element supports the rows and cols attributes which determine the height and width, respectively, of the element.
When rendered by the browser, textarea fields can be stretched/shrunk in size by the user, but the rows and cols attributes determine the initial size.
Unlike the input element, the <textarea> element has both opening and closing tags. The value of the element is the content in between these tags (much like a <p> element). The code block shows a <textarea> of size 10x30 and with a name of "comment".</textarea></textarea>
Forms
《form》 Element
The HTML <form> element is used to collect and send information to an external source.
<form> can contain various input elements. When a user submits the form, information in these input elements is passed to the source which is named in the action attribute of the form.
![!BS! ](https://s3.amazonaws.com/brainscape-prod/system/cm/399/783/253/a_image_ios.?1665321022 "eyJvcmlnaW5hbFVybCI6Imh0dHBzOi8vczMuYW1hem9uYXdzLmNvbS9icmFpbnNjYXBlLXByb2Qvc3lzdGVtL2NtLzM5OS83ODMvMjUzL2FfaW1hZ2Vfb3JpZ2luYWwuP2M0OGUyNzA1MzZmNGZmOTIyMmMzY2IwYjEzNjFiZmNjIn0=")
</form>
Forms
<input></input>: Number Type
HTML input elements can be of type number. These input fields allow the user to enter only numbers and a few special characters inside the field.
The example code block shows an input with a type of number and a name of balance. When the input field is a part of a form, the form will receive a key-value pair with the format: name: value after form submission.
Forms
<input></input> Element
The HTML <input></input> element is used to render a variety of input fields on a webpage including text fields, checkboxes, buttons, etc. <input></input> element have a type attribute that determines how it gets rendered to a page.
The example code block will create a text input field and a checkbox input field on a webpage.
Forms
<input></input>: Range Type
A slider can be created by using the type=”range” attribute on an HTML input element. The range slider will act as a selector between a minimum and a maximum value. These values are set using the min and max attributes respectively. The slider can be adjusted to move in different steps or increments using the step attribute.
The range slider is meant to act more as a visual widget to adjust between 2 values, where the relative position is important, but the precise value is not as important. An example of this can be adjusting the volume level of an application.
Forms
<select> Element</select>
The HTML <select> element can be used to create a dropdown list. A list of choices for the dropdown list can be created using one or more <option> elements. By default, only one <option> can be selected at a time.</option></option></select>
The value of the selected <select>’s name and the <option>’ s value attribute are sent as a key-value pair when the form is submitted.</option></select>
Forms
Submitting a Form
Once we have collected information in a form we can send that information somewhere else by using the action and method attribute. The action attribute tells the form to send the information. A URL is assigned that determines the recipient of the information. The method attribute tells the form what to do with that information once it’s sent. An HTTP verb is assigned to the method attribute that determines the action to be performed.