reading-notes

201_Read_04

This is important because…

Both positioning and functions, play a vital and crucial role to building well designed sites.

Learn HTML

Houses links for tutorials and other challenges.

Without links, there is no web; links connect sites to other sites. URLs (Uniform Resource Locator) can point to HTML files(sites/pages), images, videos, audio, text file, and more. The parts needed to create a link are an <a> element with an href attribute in the opening tag.

Functionality of links extend to various elements, including block-level ones; only need to wrap the desired link with an <a> element. The addition of a title attribute (usually after the href) allows additional text to show up when the cursor hovers over the mouse, where the dev may add a description or provide context about what’s to come should they click/activate the link, not really an “accessibility” inclusion as screen readers or navigating through keyboard strokes might not be able to invoke the “hover”.

More information on how requests for sites are made with the use of web servers and what web servers are.

Paths

Attributes

Answers.1

  1. To create a basic link, we wrap text or other content inside what element?
    • <a> or anchor tag.
  2. The href attribute contains what information?
    • the link/location to the link, same page or external; url.
  3. What are some ways we can ensure links on our pages are accessible to all readers?
    • descriptive text in plain text, or in titles, bolds, italics.

CSS Layout

Landing page for tutorials and challenges

Having the layout in mind when designing a page allows one as a developer to control the positioning and be prepared for how different elements will interact with each other, different resolutions, and window sizes.

Normal Flow

Default Behavior

Overriding Normal Flow

Methods to override normal flow are as follows,

Positioning

Changes the behavior of elements by taking them out of normal flow, expands on overriding, through the use of the position property in CSS.

Static

Default, every element begins with. no need to state/define/write out in CSS, but looks like position: static; within CSS rule.

Relative

We define relative as the value for the position property, then expand on it (and the following positions henceforth) with the top, bottom, left, and right properties.
For relative, think opposite of the property you define. As in, if define top, it will be pushed down by the measurement specified, or pushed from the “top”. left, it will pushed to the right or pushed from the “left”, and so on.

Absolute

Again defined as the value for the position property. absolute elements no loger exist within the normal flow, the space they once took is then/filled in by the surrounding elements and it sits within its own layer.
Think in terms of pop-ups, dialogue boxes, etc.

The way this value moves the element is the “opposite” of relative, in a way. The units of measurement dictate the distance the element should sit from the parent elements sides.

Z-index refres to z-axis and controls the “stacking” order of the elements. The higher/ positive value, the more to the top/background; the lower/negative value, the more to the background.

Fixed

Places the element relative to the viewport of the browser; very similar to absoulte (relative to the nearest ancestor element).

Persistent elements in same location, regardless of where you scroll or go on the site.

selector {
    position: fixed;
    top: 0;

The above CSS snippet makes the <h1> element stick to the top of the screen and removes it form normal flow.

Sticky

Combination of relative and fixed. Element is positioned relatively to a certain point, then becomes fixed.

Think moving Row headers that become superceeded by relevant headers per section.

Answers.2

  1. What is meant by “normal flow”?
    • default positioning and styling; before CSS.
  2. What are a few differences between block-level and inline elements?
    • Block - takes full width of line and starts on new line. <p>, <h#>.
    • Inline - places elements side-by-side, not new line; content only takes up space. <a>, <span>, <strong>.
  3. ___ positioning is the default for every html element.
    • Static, stays in normal flow; not affected by top, left, bottom.
  4. Name a few advantages to using absolute positioning on an element.
    • useful for overlays, tool tips; collapsible menu ‘     ’ (rotated 90 deg).
    • displays over other content as you scroll; think, layered.
  5. What is a key difference between fixed positioning and absolute positioning?
    • Absolute = moves with the page or its container. In relation to parent element. Removed from normal flow. defaults to <body> for relative.
      • “place where I want!”
    • Fixed = stays fixed to the screen (viewport) when you scroll. “goes where you go”. -Relative - …

Learn JS

Landing page with links to tutorials and challenges aimed at teaching the essentials and provide foundation for further learning.

Functions

A storage mechanism for code that does a single task, which you may invoke and use at a later time.

Where’s the Fun(ction) at?

Everywhere. They’re used to make developing easier and keeping developers sane (..attempt).

Browser Built-in

Functions can be used to manipulate,

Many are built-in and ready to use, even though they might not be written in javascript (C++/lower level language browser is built on or through APIs).

Functions vs. Methods

Functions are methods, when written to be part of an object.
Custom functions are just that, functions written specifically for the task at hand.

Invocation

The process of running the actual function is called, invoking. To invoke a function, you specify the function name followed by a pair of parentheses (and any arguments, if appropriate), then a semi-colon.

Being able to call other functions within a function (should they be globally accessible) is a trait.

Parameters

Not all functions do, but there some that require parameters to be specified in order to complete it’s job. parameters go within the parentheses. There are also functions that expect a parameter(s) to be specified, but when they aren’t; they adopt a default behavior.

Anonymous & Arrow

Anonymous functions have no name and expect a function to be its parameter (function expression).

Rather than using the function keyword; arrow functions are specified through the use of =>.

Scope and Conflicts

To avoid conflicting variable names and possible malicious actions from external scripts; two separate scopes exist. The local scope that says, variable defined within a function can only be recalled within that specific function call. The global scope is from where you may pull from throughout the entire script and within other functions. Local can called upon from only that instance, global can be called from every instance.

Answers.3

  1. Describe the difference between a function declaration and a function invocation.
    • declaring involves outlining what code will be run; invocating is the actual process of running it when called.
  2. What is the difference between a parameter and an argument?
    • parameter - a placeholder; usually a variable that will fill in where input with contents of variable
    • argument - an actual value plugged in for the function;

Misc. - 6 Reasons for Pair Programming

  1. Pick 2 benefits to pair programming and reflect on how these benefits could help you on your coding journey.
    • collaboration allows peer review, feedback, different perspectives/styles to merge, allows opportunity to improve code quality and production efficiency

Things I want to know more about