Random Notes Flashcards
(83 cards)
Code reading for html-relative-links:
anchor tag href=”../about-me/about-me.html”
There is an opening tag for the anchor element and there is an href attribute with a value of a relative URL pointing to the about-me.html file within the about-me directory within the parent directory (..).
- The forward slash is read as “within” and we start with the file we are trying to actually read (subject first)
- We call them folders day to day, but it’s really called the directory”
Should you use divs or br to change up the document flow
Use divs to change document flow
br elements should only be used for breaking up text.
Do you need a label element for form control elements?
Not always. If there’s no text labeling the input area then you don’t need labels. You can just use placeholder attribute.
Code reading for CSS-colors
CSS selector { *background-color: rgb(244, 249, 251)}
we have a property with a CSS function, rgb, with the ARGUMENTS (244, 249, 251)
CSS: How background-colors work?
thead tr th tr thead
“Hey dude! Great question, that is because if you apply the styling to thead, the background color you are applying to the tr element will overlay that background color, and it would not be visible”
The child elements overlay the parent elements
CSS: Code reading for pseudo class and descendants and children.
table.striped thead > tr:nth-child(odd)
A new css rule set with a selector for the tr element with a pseudo class (nth-child) with an argument odd which is a direct child of thead and is a descendant of the table element with a class striped.
TIP:
CSS Layout control rules
Container should always be the external layer
Containers only hold rows
Rows should only hold columns
Guide to make classes for HTML and CSS
Utility classes = named after the desired behavior. It’s made to be used multiple times, things that repeat. It should only have one or two things it does. They shouldn’t be changed. Instead make a new class with the desired behavior.
Semantic classes = named after what it’s holding. Add as last attribtute after all the utility classes
Two things container should always have?
Width or max width AND margin: auto;
What is the only thing that should be in the row class?
display: flex;
What are the only things in a column class?
Only width
Position absolute has to be a child of relative.
Most of the time, but not always.
Width:100% or offset properties of top, bottom. right. and left set to a value of 0?
Both work.
Offset values of 0 will make it take all available width.
Primary use of absolute positioning?
If you need to layer something on top of something else.
CSS Layout classes for row, column, and container.
Row = display flex; column= width container = width (with hard px val) and margin auto
JavaScript code reading:
console.log(‘value of:’, typeof fullName);
the log method of the console object is being called with two arguments, the string, value of, and the result of the expression typeof fullName
JavaScript code reading ‘.’ is read how?
How is vehicle[‘color’] = ‘white’ read?
the dot (period symbol) is read as of
the string white is being assigned to the variable vehicle at string color (brackets are read as ‘at’)
Good thing to note about objects and primitive data
var me = {name: "john", age:"20"}; undefined var otherMe = me undefined otherMe.name = 'chad' 'chad' me {name: 'chad', age: '20'} var a = 1 undefined var b = a undefined var a = 12 undefined a 12 b 1
Square brackets [ ] =
Curly brace { } =
square is for array literal
curly brace is for object literal
Data Modeling, think about data what you need and how to store it
It’s best to create a diagram or something to plan out the data.
What is a javascript expression?
Chunk of code that is being evaluated and returning a value
JavaScript code reading:
function convertMinutes(minutes) { var seconds = minutes * 60; return seconds; }
var convertMinutes = convertMinute(5);
a function is being defined with the name convertMinutes with one parameter named ‘minute’
the value of minutes is being multiplied by the number 60 and the result of that expression is being assigned to the variable seconds
the variable seconds is being returned FROM the function.
the function convertMinutes is being called with one argument, the number 5, the return of that function call is being assigned to var convertMinutes
CSS E-commerce challenge (due Monday, probably can be done by Friday)
strikethrough element? s
background color on current price
LV picture is a different sized picture on purpose (challenge)
object-fit (css property) - useful to adjust height/width without messing up aspect ration on images
How to read:
var something = math.floor(randomValues)
var firstBook = library.shift();
the floor method of the math object is being called with one argument, the variable randomValues and the return of that method is being assigned to the variable something
the shift method of the library object is being called with no arguments and the return of that method is being assigned to the variable firstBook