Module 1 Flashcards
Give five examples of HTML element tags.
<p>, <img></img>, </p>
,<span> ,</span>, h1, h2
What is the purpose of HTML attributes?
allow you to add functionality to an HTML element
Give an example of an HTML entity (escape character).
Copyright symbol (©)
Where do you put visible content about the HTML document?
inside of the body element
Where do the body and head tags go in a valid HTML document?
inside of the main html element
Where do you put non-visible content about the HTML document?
head element
What is the purpose of the DOCTYPE element
to declare the version of HTML that the webpage uses
How do block-level elements affect the document flow?
they are shown on a new line; can add individual CSS styling using CLASS or ID attributes
How do inline elements affect the document flow?
are shown on the same line as elements before or after; can add CSS styling
What are the default width and height of a block-level element?
width: 100% of the parent element
height: height of content
What are the default width and height of an inline element?
only take as much space as needed (even if you set height and width attributes)
What is the difference between an ordered list and an unordered list in HTML?
ordered lists = numbered
unordered = bullet points
Is an HTML list a block element or an inline element?
block
What HTML tag is used to link to another website?
anchor (a) tag (usually w/ href attribute)
What is an absolute URL?
URL that referneces a different website
What is a relative URL?
URL of another page of same website
How do you indicate the relative link to a parent directory?
two dots and a forward-slash (../)
How do you indicate the relative link to a child directory?
a forward-slash and the name of the directory (/__CHILD NAME__)
How do you indicate the relative link to a grand parent directory?
two dots, back-slash, two dots, forward-slash (../../_file name__)
How do you indicate the relative link to the same directory?
just the file name or a dot and forward-slash (./)
What is the purpose of an HTML form element?
to allow the user to enter data and the webpage to collect that data
Give five examples of form control elements.
text, textarea, radio buttons, checkbox, select (dropdown list), submit button, file upload
Give three examples of “type” attributes for HTML input elements
“radio” (radio buttons), “text” (simple text), “submit” (submit button), “checkbox” (check box), “file” (upload a file), “hidden” (adds functionality to other element w/out alerting user), “password”, “email”
Is an HTML 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"
What purpose do the “thead” and “tbody” elements serve?
they distinguish the content of the table from one another for screen reading and styling; divide table and give some info about what is in the divisions
Give two examples of data that would lend itself well to being displayed in a table.
financial report, sports statistics
What are the names of the individual pieces of a CSS rule?
selector and declaration block
In CSS, how do you select elements by their class attribute?
CSS: . __classname__{ }
HTML: include “class = ___” attribute in the opening tag of the element
In CSS, how do you select elements by their type?
list the element type as the selector
In CSS, how do you select an element by its id attribute?
CSS: # __idname__ { }
HTML: include “id = ___” attribute in the opening tag of the element
Name three different types of values you can use to specify colors in CSS.
RGB, hexcode and color name
What CSS properties make up the box model?
Margin, border, padding, content
Which CSS property pushes boxes away from each other?
margin
Which CSS property pushes box content away from its border?
padding
What is a pseudo-class?
keyword added to a selector that specifies a special state of the selected element(s); use ‘ : ‘ to specify pseudo-class
What are CSS pseudo-classes useful for?
making pages more interactive
What CSS properties make up the box model?
margin, border, padding
Which CSS property pushes boxes away from each other?
margin
Which CSS property add space between a box’s content and its border?
padding
Name at least two units of type size in CSS.
pixel, percentage, em
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 (block level elements take up 100% of the width of the parent element)
What is the default flex-direction of an element with display : flex?
row (L to R)
What is the default value for the position property of HTML elements?
static
How does setting position: relative on an element affect document flow?
it doesn’t; the element stays in the doc flow
How does setting position:relative on an element affect where it appears on the page?
it doesnt; but you can move the element in relation to where it would be in it’s fixed position using the 4 box offset properties
How does setting position:absolute on an element affect document flow?
it takes the element out of the normal doc flow; other elements will respond to the space the element takes up
How does setting position:absolute on an element affect where it appears on the page?
it appears above the parent element
How do you constrain an absolutely positioned element to a containing block?
put absolutely positioned element inside a div element w/ position set to
What are the four box offset properties?
top, bottom, left, right
What is the purpose of variables?
to hold data for future use
How do you declare a variable?
using var __var name__ = __value__; using the var keyword
How do you initialize (assign a value to) a variable?
using = (assignment operator)
What characters are allowed in variable names?
LETTERS, $, _; cant begin w/ a number
What does it mean to say that variable names are “case sensitive”?
there is a difference between a capital and lowercase letter in the variable names
What is the purpose of a string?
to hold text content
What is the purpose of a number?
to hold numerical characters; allow for mathematical calcs
What is the purpose of a boolean?
to hold logical values (true and false)
What does the = operator mean in JavaScript?
assignment operator; assigns a value to something
How do you update the value of a variable?
__name of var__ = __new value__
What is the difference between null and undefined?
null is an intentionally invalid/nonexistent value; undefined is a value that does not exist
null = empty parking lot (created to be empty); undefined = open field (empty by its nature)
Why is it a good habit to include “labels” when you log values to the browser console?
for readability, clarity, and debugging
Give five examples of JavaScript primitives.
numbers, strings, boolean, null and undefined
What data type is returned by an arithmetic operation?
numeric
What is string concatenation?
the combining of >=two strings to make one string
What purpose(s) does the + plus operator serve in JavaScript?
addition, concatenation
What data type is returned by comparing two values (, ===, etc)?
Boolean
What does the += “plus-equals” operator do?
it increments/concatenates and reassigns the new value to the original variable
What are objects used for?
to store information in key:value pairs; used to model real world data
What are object properties?
they are the keys of the key:value pairs inside an object
Describe object literal notation.
declaring the object name using the ‘var’ keyword and { }
How do you remove a property from an object?
the ‘delete’ keyword
What are the two ways to get or update the value of a property?
dot notation: __obj name__ . __key name__ = __value___
bracket notation: __obj name__ [ __key name__] = __value___
What are arrays used for?
storing a list of related values
Describe array literal notation.
declare a variable –> assign variable a set of values contained in [ ] and separated by commas
How are arrays different from “plain” objects?
they are indexed, they do not have key:value pairs
What number represents the first index of an array?
0
What is the length property of an array?
a tool to get the number of items in an array
How do you calculate the last index of an array?
__array name__ . length - 1
What is a function in JavaScript?
a way to store and reuse code that produces an output
Describe the parts of a function definition.
function \_\_functName\_\_(parameter1, ... ) { \_\_code\_\_ return \_\_output\_\_ }