Code Fellows 201
Day 03 Notes
Home
Continue Reading Introduction to HTML
HTML Text Fundamentals. HTML Advanced Text Formatting.
Why is it important to use semantic elements in our HTML?
- we rely on previous experience to tell us what the function of an everyday object is; when we see something, we know what its function will be.
How many levels of headings are there in HTML?
- There are six heading elements: <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>. Each element represents a different level of content in the document; <h1> represents the main heading, <h2> represents subheadings, <h3> represents sub-subheadings, and so on.
What are some uses for the <sup> and <sub> elements?
- You will occasionally need to use superscript and subscript when marking up items like dates, chemical formulae, and mathematical equations so they have the correct meaning.
When using the <abbr> element, what attribute must be added to provide the full expansion of the term?
- If providing the expansion in addition to the abbreviation makes little sense, and the abbreviation or acronym is a fairly shortened term, provide the full expansion of the term as the value of title attribute
Learn CSS
How CSS Is Structured.
What are ways we can apply CSS to our HTML?
- External stylesheet
An external stylesheet contains CSS in a separate file with a .css extension. This is the most common and useful method of bringing CSS to a document. You can link a single CSS file to multiple web pages, styling all of them with the same CSS stylesheet. In the Getting started with CSS, we linked an external stylesheet to our web page.
You reference an external CSS stylesheet from an HTML <link> element:
-
Internal stylesheet
An internal stylesheet resides within an HTML document. To create an internal stylesheet, you place CSS inside a <style> element contained inside the HTML <head>.
-
Inline styles
Inline styles are CSS declarations that affect a single HTML element, contained within a style attribute.
Why should we avoid using inline styles?
-
It is the opposite of a best practice. First, it is the least efficient implementation of CSS for maintenance. One styling change might require multiple edits within a single web page. Second, inline CSS also mixes (CSS) presentational code with HTML and content, making everything more difficult to read and understand. Separating code and content makes maintenance easier for all who work on the website.
-
There are a few circumstances where inline styles are more common. You might have to resort to using inline styles if your working environment is very restrictive. For example, perhaps your CMS only allows you to edit the HTML body. You may also see a lot of inline styles in HTML email to achieve compatibility with as many email clients as possible.
Review the block of code below and answer the following questions:
h2 {
color: black;
padding: 5px;
}
What is representing the selector?
Which components are the CSS declarations?
- color: black;
padding: 5px;
Which components are considered properties?
Learn JS
Continue reading JavaScript Basics. Start at “Comments” and read through “Events” section.
What data type is a sequence of text enclosed in single quote marks?
List 4 types of JavaScript operators.
- Addition Add two numbers together or combine two strings. +
- Subtraction, Multiplication, Division These do what you’d expect them to do in basic math. -, *, /
- Assignment As you’ve seen already: this assigns a value to a variable. =
- Strict equality This performs a test to see if two values are equal. It returns a true/false (Boolean) result. ===
- Not, Does-not-equal This returns the logically opposite value of what it precedes. It turns a true into a false, etc.. When it is used alongside the Equality operator, the negation operator tests whether two values are not equal. !, !==
Describe a real world Problem you could solve with a Function.
- calculate a tip amount based off a percent
Making Decisions In Your Code – Conditionals.
An if statement checks a EXPRESSION and if it evaluates to TRUE, then the code block will execute.
What is the use of an else if?
- The expression inside the if () is the test. This uses the strict equality operator (as described above) to compare the variable iceCream with the string chocolate to see if the two are equal. If this comparison returns true, the first block of code runs. If the comparison is not true, the second block of code—after the else statement—runs instead.
List 3 different types of comparison operators.
- === and !== — test if one value is identical to, or not identical to, another.
- < and > — test if one value is less than or greater than another.
- <= and >= — test if one value is less than or equal to, or greater than or equal to, another.
What is the difference between the logical operator && and ||?
Bookmark and Review
https://chris.beams.io/posts/git-commit/