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>.