HTML Flashcards
HTML skeleton, syntax, block and inline, lists, links, relative links
Where do you put non-visible content about the HTML document?
Between the head element opening and closing tags.
Where do you put visible content about the HTML document?
Between the body element opening and closing tags.
Where do the <head> and <body> tags go in a valid HTML document?
Between the doctype declaration and the HTML element opening and closing tags.
What is the purpose of a <!DOCTYPE> declaration?
Tell the browser which version of HTML the page is using, it helps the browser render the page correctly.
Give five examples of HTML element types.
Html, head, body, h1, p
What is the purpose of HTML attributes?
Attributes provide additional information about the contents of an element.
Give an example of an HTML entity (escape character).
” & a m p ; “ for ampersand
“ & e a c u t e ; “ - accent on e
How do block-level elements affect the document flow?
They create elements that will start on a new row and use the entirety of the row (horizontal space)
How do inline elements affect the document flow?
Appears on the same line as their neighboring elements.
What are the default width and height of a block-level element?
The default height is the height of the content and the width is the entire length of the page.
What are the default width and height of an inline element?
The default height and width is the height of the content and the width of the content.
What is the difference between an ordered list and an unordered list in HTML?
Ordered lists are numbered (alphabetical, etc.) and unordered lists begin with a bullet point (squares, etc.).
Is an HTML list a block element or an inline element?
Block element
What HTML tag is used to link to another website?
<a> tag and href attribute.</a>
What is an absolute URL?
Full web address of a site to visit a specific page.. (domain name for that site, followed by the path to a specific page).
What is a relative URL?
Links to other pages within the same site. (shorthand versions because they do not need the domain name).
How do you indicate the relative link to a parent directory?
Use ../ to indicate the folder above the current one, then the file name. <a href= “../index.html”>
How do you indicate the relative link to a child directory?
Name of child folder, followed by forward slash, the the file name . <a href= “ child/child.html “ >
How do you indicate the relative link to a grand parent directory?
You can use ../ as many times to reach the root directory/grandparent directory
How do you indicate the relative link to the same directory?
You can just name the file of the directory <a href = “ filename.html”>
What is the purpose of an HTML form element?
The form element identifies the webpage as a form in which a user can input information
Give five examples of form control elements.
Input, label, select, button, option
Give three examples of type attribute values for HTML <input></input> elements.
Radio, checkbox, email, submit, time, calendar
Is an HTML <input></input> element a block element or an inline element?
Inline
What are the six primary HTML elements for creating tables?
Table, tr, td, th, tbody, thead, (optional: tfoot)
What purpose do the thead and tbody elements serve? (semantic elements)
thead= defines a set of rows defining the head of the columns of the table
tbody= encapsulates a set of table rows, indicating that they comprise the body of the table.
Helps people who needs screen readers, improves search engine indexing, control appearance of tables better
Give two examples of data that would lend itself well to being displayed in a table.
TV schedules, stocks
What are the names of the individual pieces of a CSS rule?
Selector, declaration, property, value
In CSS, how do you select elements by their class attribute?
.class (period followed by the class name)
In CSS, how do you select elements by their tag name?
Just use the element name followed by {}.
In CSS, how do you select an element by its id attribute?
ID (hashtag followed by the ID name)
Name three different types of values you can use to specify colors in CSS.
Rgb values, hex codes, color names.
What CSS properties make up the box model?
Border, margin , padding, content
Which CSS property pushes boxes away from each other?
Margin
Which CSS property add space between a box’s content and its border?
padding
What is a pseudo-class?
A keyword added to a selector that specifies a special state of the element.
What are CSS pseudo-classes useful for?
Pseudo-classes allow for stylization of elements in relation to external factors, status of the content, or the position of the mouse.
Makes changes based on user interaction
Name two types of units that can be used to adjust font-size in CSS.
Pixels, percentages, em, etc.
What CSS property controls the font used for the text inside an element?
font-family
What is the default flex-direction of a flex container?
row
What is the default flex-wrap of a flex container?
no wrap
Why do two div elements “vertically stack” on one another by default?
They are block-level elements and will not allow other elements to sit next to it
What is the default flex-direction of an element with display: flex?
row
What are the three primary components of a page layout? (Which helper classes do you need?)
Container, column, row
What is the minimum number of columns that you should put in a row?
1
What is the purpose of a container?
Contains everything in the web page to group together
Gives us a boundary for the web page.
What is the default value for the position property of HTML elements?
static
How does setting position: relative on an element affect document flow?
Element remains in normal document flow.
An elements final position can be modified to overlap other elements
How does setting position: relative on an element affect where it appears on the page?
Will not affect where it appears on the page. It will stay in the same place.
You can control how far an element is placed from its original position.
How does setting position: absolute on an element affect document flow?
Element will be removed from normal document flow.
How does setting position: absolute on an element affect where it appears on the page?
Element will be positioned relative to closest positioned non-static ancestor.
The element sits on its own separate layer from all other elements
How do you constrain an absolutely positioned element to a containing block?
You make the containing block that you want it to be positioned to into a relative position. They will position themselves within the first non-static ancestor.
Parent element can use (Absolute, sticky, fixed) to be a non static element
What are the four box offset properties?
Top, bottom, left, right
What is the purpose of variables?
To store data
How do you declare a variable?
Keyword + creating a variable and giving it a name.
How do you initialize (assign a value to) a variable?
Using the assignment operator. (=)
What characters are allowed in variable names?
letters , numbers, $ dollar sign, _ underscore
What does it mean to say that variable names are “case sensitive”?
A variable starting with a lowercase and a variable starting with an uppercase will create two separate variables.
What is the purpose of a string?
Hold data type consisting of letters/ other characters. Any type of text content.
What is the purpose of a number?
Hold any data type handling numbers/numeric values. Counting, calculating sums, determining size, moving the position, setting time, etc.
What is the purpose of a boolean?
To hold data types of true or false.
To turn a script on or off.
What does the = operator mean in JavaScript?
Assign a value to the variable, also used to update the value given to a variable.
How do you update the value of a variable?
Using the assignment operator.
Do not need to use ‘var’ again, just the name and (=)
What is the difference between null and undefined?
Null represents a placeholder value, might hold value in the future.
Undefined is a value that has not been thought of yet, does not hold value yet.
Why is it a good habit to include “labels” when you log values to the browser console?
To help debug. It makes it clearer which variables are being logged and in which order.
Give five examples of JavaScript primitives.
String, number, boolean, undefined, null
What data type is returned by an arithmetic operation?
A numerical value
What is string concatenation?
The joining of two or more strings using (+) to create a new string
What purpose(s) does the + plus operator serve in JavaScript?
This will combine the value of the string before and after the (+) operator
(a concatenated string)
Addition for numerical numbers.
What data type is returned by comparing two values (<, >, ===, etc)?
true/false
What does the += “plus-equals” operator do?
This will add the number value on the right and assigns the result to the variable
What are objects used for?
To group together a set of variables and functions to create a model.
What are object properties?
Variables that are part of an object.
Describe object literal notation.
The object is in curly braces with its contents, then stored in a variable. Each key is separated from its value using a colon and each property and method is separated with a comma.
Var (varName) = { property: ‘string’, };
How do you remove a property from an object?
Use keyword delete then dot notation to identify the property or method you want to remove from the object.
Delete var.varName;
What are the two ways to get or update the value of a property?
Using square brackets or dot notation.
Bracket: varName[‘newString’] = ‘updatedVal’;
Dot: varName.newString = updatedVal;
What are arrays used for?
To create ordered list of data.
Describe array literal notation.
Var varName = [ ‘one’, ‘two’, ‘three’];
Open brackets
List of data values followed by commas
How are arrays different from “plain” objects?
Arrays are a special type of objects, they hold a related set of values
Arrays use numbers as indexes