Module 1 Flashcards
Where do you put non-visible content about the HTML document?
This type of content goes in the head element
Where do you put visible content about the HTML document?
This type of content goes in the body element
Where do the head and body tags go in a valid HTML document?
These tags go in the html element
What is the purpose of a !DOCTYPE declaration?
This tag tells you what type of document you are working on and also specifies the specific version
Give five examples of HTML element tags.
<p> p
</p>
<h1> h1 </h1>
through<h6> h6 </h6>
<img></img> img
<a> a</a>
<div> div </div>
</a>
What is the purpose of HTML attributes?
these allow you to provide additional information about your html elements by assigning attributes to specific values.
Give an example of an HTML entity (escape character).
without spaces
© “& copy ;”
® “& reg ;”
€ “& eruo ;”
& “& amp ;”
How do block-level elements affect the document flow?
These types of elements take up as much space as they can and elements always start on a new line
How do inline elements affect the document flow?
These types of elements take up as much space as they need and appear adjacent to other elements
What are the default width and height of a block-level element?
Default width=full width available on the screen
Default height=height of the content
What are the default width and height of an inline element?
Default width=width of the content *cannot be changed
Default height=height of the content
What is the difference between an ordered list and an unordered list in HTML?
Unordered lists <ul> are not in a specified order and by default notated with bullet points
Ordered lists </ul><ol> are numbered and in a specified orderer</ol>
Is an HTML list a block element or an inline element?
This is a block element
What HTML tag is used to link to another website?
The anchor tag <a></a>
What is an absolute URL?
The full web address containing domain name
To be used for external links on other sites
What is a relative URL?
The file path for a file within the same domain, can notate this shorthand in html
To be used for internal links to link files on the same site
How do you indicate the relative link to a parent directory?
to indicate
a href=”../file-name”>Text Content /a
How do you indicate the relative link to a child directory?
to indicate
a href=”folder-name/file-name”Text Content/a
How do you indicate the relative link to a grand parent directory?
a href=”../../file-name”>Text Content/a
How do you indicate the relative link to the same directory?
to indicate
a href=”file-name”>Text Content/a
What is the purpose of an HTML form element?
the purpose of this is to allow users to input information on a webpage via a form which is tracked by key value pairs i.e. Name: Hannah (key value pair would be saved as name=name, value=Hannah)
Give five examples of form control elements.
5 examples are:
1. Text input
2. Password input
3. Radio buttons
4. Checkboxes
5. Submit buttons
Give three examples of type attributes for HTML elements.
3 examples are:
1. type=”text”
2. type=”password”
3. type=”radio”
Is an HTML input element a block element or an inline element?
this element is inline
What are the six primary HTML elements for creating tables?
- table
- thead
- th
- tbody
- tr
- td
What purpose do the thead and tbody elements serve?
These elements signify the heading and body sections of the table to make it clearer for screenreading and also because if the table is longer than the screen, the browser can keep the header visible while you are scrolling down the page
Give two examples of data that would lend itself well to being displayed in a table.
- Financial Reports
- Pricing plan charts (different types of jelly plans and pricing)
What are the names of the individual pieces of a CSS rule?
Selector & Declaration Block (with Properties & Values)
In CSS, how do you select elements by their class attribute?
with a .
In CSS, how do you select elements by their type?
with the name of the element
In CSS, how do you select an element by its id attribute?
with a #
Name three different types of values you can use to specify colors in CSS.
- rgb ()
- # hexcode
- Name (147 built in to CSS)
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 add space between a box’s content and its border?
padding
What is a pseudo-class?
a keyword added to a selector the specifies a special state of the selected element(s)
What are CSS pseudo-classes useful for?
they allow you to change the style of the element when you interact with the webpage (i.e. hover)
Name at least two units of type size in CSS.
pixels
percentages
ems
What CSS property controls the font used for the text inside an element?
font-family
What are the four components of “the Cascade”.
- Source Order
- Inheritance
- Specificity
- !important
What does the term “source order” mean with respect to CSS?
the order dictating importance on styling when the same elements of the same specificity are being used
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
Inheritance - children receive parent styling by default
List the three selector types in order of increasing specificity.
- type selector (p)
- class selector (p.class)
- ID selector (p#id)
- Inline styling (bad practice)
- !important (bad practice)
Why is using !important considered bad practice?
bad practice because it breaks natural cascading and makes debugging more difficult
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?
because they are block-level elements
What is the default flex-direction of an element with display: flex?
row
What is the default value for the position property of HTML elements?
position: static
How does setting position: relative on an element affect document flow?
position: relative element will going on top of other elements (as they stay statically positioned to where they should have been if that element were not moved)
How does setting position: relative on an element affect where it appears on the page?
position: relative will allow that element to move relative to where it normally should have been, going on top of other elements (as they stay statically positioned to where they should have been)
How does setting position: absolute on an element affect document flow?
position: absolute makes other elements treat this element as if it does not exist
How does setting position: absolute on an element affect where it appears on the page?
position: absolute positions element relative to the parent container
How do you constrain an absolutely positioned element to a containing block?
set the container you want to constrain it to a non-static position (position: absolute elements will constrain themselves to the nearest non-static container)
What are the four box offset properties?
top
bottom
right
left
What is the purpose of variables?
variables store data of a script into a variable for later use that can be changed
How do you declare a variable?
using the var keyword (or const or let), variable name, and assignment operator
var variableName = ‘value’;
How do you initialize (assign a value to) a variable?
using the assignment operator (=)
What characters are allowed in variable names?/What are the rules?
- Must begin with a letter, $ or _
- cannot use a - or .
- cannot use keywords or reserved words
- case sensitive
- Non-mystical variable names
- capitalize after 1st word
What does it mean to say that variable names are “case sensitive”?
variable and Variable are not the same variable
What is the purpose of a string?
labelling, adding new content to a page
What is the purpose of a number?
for arithmetic operations / calculations
What is the purpose of a boolean?
assigning true and false values and acting like an on/off switch to determine which part of the script should run
What does the = operator mean in JavaScript?
assignment
How do you update the value of a variable?
later in the script, set the variable = to the new value
What is the difference between null and undefined?
null is of type object that is non-existent or empty
undefined if of type undefined which is automatically assigned a value of undefined since no value is specified
Why is it a good habit to include “labels” when you log values to the browser console?
makes the console.log easier to understand and read especially when consoling many things at once
Give five examples of JavaScript primitives.
- String
- Boolean
- Number
- Null
- Undefined
What data type is returned by an arithmetic operation?
Number
What is string concatenation?
addition of two strings together with +
What purpose(s) does the + plus operator serve in JavaScript?
string concatenation and arithmetic additions
What data type is returned by comparing two values (, ===, etc)?
Boolean (true/false)
What does the += “plus-equals” operator do?
shorthand for adding variable to a value and assigning the variable equal to that result i.e.
variableName += 2 is the same as variableName = variableName +2
What are objects used for?
used to group together key value pairs including data and functions that relate back to a real-world object
i.e. person -> functions like breathing, eating, sleeping and data like favorite color, name
What are object properties?
variables of object
Describe object literal notation.
var object = {
property1: value 1,
property2: value2
};
How do you remove a property from an object?
delete keyword
What are the two ways to get or update the value of a property?
dot notation or bracket notation
dot notation has to be the exact name of the property
What are arrays used for?
useful for things where order matters i.e. recipe, shopping list, top 10 favorite movies
Describe array literal notation.
var array = [ num1, num2, num3];
How are arrays different from “plain” objects?
doesn’t have key value pairs, order matters
What number represents the first index of an array?
0