LFZ Flashcards
Where do you put non-visible content about the HTML document?
head element
Where do you put visible content about the HTML document?
body element
Where do the and tags go in a valid HTML document?
inside the html element
What is the purpose of a declaration?
to tell a browser which version of HTML the page is using
Give five examples of HTML element types.
html, head, title, body, h1, h2, h3, h4, h5, h6, p, div, span, a
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).
Less-than sign - & lt; Greater-than sign - & gt; Ampersand - & amp; Quotation mark - & quot; Cent-sign - & cent; Pound sign - & pound; Yen sign - & yen; Euro sign - & euro; Copyright symbol - & copy; Registered trademark - & reg; Trademark - & trade; Left single quote - & lsquo; Right single quote - & rsquo; Left double quotes - & ldquo; Right double quotes - & rdquo; Multiplication sign - & times; Division sign - & divide;
How do block-level elements affect the document flow?
A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can).
How do inline elements affect the document flow?
An inline element does not start on a new line and only takes up as much width as necessary.
What are the default width and height of a block-level element?
The default height of a block-level element is the height of the content.
The default width of a block-level element is the length of the page.
What are the default width and height of an inline element?
The height of an inline element is the height of the content.
The width of an inline element is the width of the content.
What is the difference between an ordered list and an unordered list in HTML?
Ordered list displays numbered list. Unordered list displays bullet point list.
Is an HTML list a block element or an inline element?
block element
What HTML tag is used to link to another website?
<a> (anchor element)</a>
What is an absolute URL?
the full web address for the site
What is a relative URL?
link to other pages within the same site
How do you indicate the relative link to a parent directory?
Use ../ to indicate the folder above the current one, then follow it with the file name.
How do you indicate the relative link to a child directory?
For a child folder, use the name of the child folder, followed by a forward slash, then the file name.
How do you indicate the relative link to a grand parent directory?
Repeat the ../ to indicate that you want to go up two folders (rather than one), then follow it with the file name.
How do you indicate the relative link to the same directory?
To link to a file in the same folder, just use the file name. (Nothing else is needed.)
What is the purpose of an HTML form element?
An HTML form is used to collect user input.
Give five examples of form control elements.
input label select textarea button fieldset legend datalist output option optgroup
Give three examples of type attribute values for HTML input elements.
text, password, radio, checkbox, file, submit, image, hidden
Is an HTML element a block element or an inline element?
inline element
What are the six primary HTML elements for creating tables?
table, tr, th, td, thead, tbody
What purpose do the thead and tbody elements serve?
The headings of the table should sit inside the thead element.
The body should sit inside the tbody element.
Give two examples of data that would lend itself well to being displayed in a table.
Examples of tables include financial reports, TV schedules, and sports results.
Give 6 examples of comparison operators.
==, !=, ===, !==, > < >= <=
What data type do comparison expressions evaluate to?
boolean
What is the purpose of an if statement?
to execute code if a condition evaluates to true
Is else required in order to use an if statement?
no
Describe the syntax (structure) of an if statement.
if key word condition opening curly brace code to execute if value is true closing curly brace
What are the three logical operators?
&&
||
!
How do you compare two different expressions in the same condition?
and operator
or operator
What is the purpose of a loop?
Loops are all about doing the same thing over and over again.
What is the purpose of a condition expression in a loop?
The conditionExpression expression is evaluated. If the value of conditionExpression is true, the loop statements execute. If the value of condition is false, the for loop terminates.
What does “iteration” mean in the context of loops?
one loop
When does the condition expression of a while loop get evaluated?
before a loop begins
When does the initialization expression of a for loop get evaluated?
it’s executed once at the beginning of the first loop
When does the condition expression of a for loop get evaluated?
before each loop
When does the final expression of a for loop get evaluated?
end of the loop
Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?
break
What does the ++ increment operator do?
adds one
How do you iterate through the keys of an object?
for…in loop
What are the names of the individual pieces of a CSS rule?
selectors, declarations
In CSS, how do you select elements by their class attribute?
.class-name
In CSS, how do you select elements by their type?
element-name
In CSS, how do you select an element by its id attribute?
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?
content, padding, border, margin
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 CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s).
What are CSS pseudo-classes useful for?
allow you to change the appearance of elements when a user is interacting with them
Name two types of units that can be used to adjust font-size in CSS.
pixels, percentages, ems
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?
div elements are block-level elements by default
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?
static
How does setting position: relative on an element affect document flow?
The element is positioned according to the normal flow of the document, and then offset relative to itself based on the values of top, right, bottom, and left.
How does setting position: relative on an element affect where it appears on the page?
The offset does not affect the position of any other elements; thus, the space given for the element in the page layout is the same as if position were static.
How does setting position: absolute on an element affect document flow?
The element is removed from the normal document flow
How does setting position: absolute on an element affect where it appears on the page?
, and no space is created for the element in the page layout. It is positioned relative to its closest positioned ancestor, if any; otherwise, it is placed relative to the initial containing block. Its final position is determined by the values of top, right, bottom, and left.
How do you constrain an absolutely positioned element to a containing block?
containing block position should be set to relative
What are the four box offset properties?
top, bottom, right, left
What are the four components of “the Cascade”.
source order, inheritance, specificity, importantance
What does the term “source order” mean with respect to CSS?
Source order is, simply put, the order that your CSS rules are written in your stylesheet.
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
inheritance
List the three selector types in order of increasing specificity.
type, class, id
Why is using !important considered bad practice?
Using !important, however, is bad practice and should be avoided because it makes debugging more difficult by breaking the natural cascading in your stylesheets.
The transition property is shorthand for which four CSS properties?
transition-property, transition-duration, transition-timing-function, and transition-delay
What is the purpose of variables?
store information
How do you declare a variable?
var variable;
How do you initialize (assign a value to) a variable?
var variable = value;
What characters are allowed in variable names?
letters, numbers, dollar signs, underscore
What does it mean to say that variable names are “case sensitive”?
variables with the same name but different cases are different variables