reading-notes

Notes for Codefellows Code 401 301 201 and 102

Class 1 Responsive Web Design, Floats, SMACCS

References:

  1. Responsive Web Design
    • https://learn.shayhowe.com/advanced-html-css/responsive-web-design/
  2. SMACSS Official Documentation
    • http://smacss.com/
  3. Floats / Grids
    • https://css-tricks.com/dont-overthink-it-grids/
    • https://css-tricks.com/all-about-floats/
    • https://www.freecodecamp.org/news/css-floats-explained-by-riding-an-escalator-57fa55232333/

Responsive Web Design

Responsive vs. Adaptive vs. Mobile

  1. Responsive
    • generally means to react quickly and positively to any change.
  2. Adaptive
    • means to be easily modified for a new purpose or situation
  3. Mobile
    • means to build a separate website commonly on a new domain solely for mobile users.

Flexible Layouts

  1. Flexible layouts
    • is the practice of building the layout of a website with a flexible grid, capable of dynamically resizing to any width.
    • Flexible grids are built using relative length units, most commonly percentages or em units.
    • These relative lengths are then used to declare common grid property values such as width, margin, or padding.
  2. Media queries
    • provide the ability to specify different styles for individual browser and device circumstances.
    • There are a couple different ways to use media queries, using the @media rule inside of an existing style sheet, importing a new style sheet using the @import rule, or by linking to a separate style sheet from within the HTML document.
    • Each media query may include a media type followed by one or more expressions. (all / screen / print / tv / braille)
    • There are three different logical operators available for use within media queries, including and, not, and only.
    • Using the and logical operator within a media query allows an extra condition to be added, making sure that a browser or devices does both a, b, c, and so forth.
      @media all and (min-width: 800px) and (max-width: 1024px) {...}
      
  3. Flexible media
    • Images, videos, and other media types need to be scalable, changing their size as the size of the viewport changes.
    • quick way to make media scalable is by using the max-width property with a value of 100%. Doing so ensures that as the viewport gets smaller any media will scale down according to its containers width.
    • To get embedded media to be fully responsive, the embedded element needs to be absolutely positioned within a parent element. The parent element needs to have a width of 100% and also needs to have a height of 0.
figure {
  height: 0;
  padding-bottom: 56.25%; /* 16:9 */
  position: relative;
  width: 100%;
}
iframe {
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

Media Queries

Media queries were built as an extension to media types commonly found when targeting and including styles. Media queries provide the ability to specify different styles for individual browser and device circumstances, the width of the viewport or device orientation for example. Being able to apply uniquely targeted styles opens up a world of opportunity and leverage to responsive web design

Viewports

viewport resolution

Flexible Media

The final, equally important aspect to responsive web design involves flexible media. As viewports begin to change size media doesn’t always follow suit. Images, videos, and other media types need to be scalable, changing their size as the size of the viewport changes

All About Floats

What is a float?

Floated elements remain a part of the flow of the web page.

Values:

What are floats used for?

Techniques for Clearing the Floats

An element that has the clear property set on it will not move up adjacent to the float like the float desires, but will move itself down past the float.

#footer {
   clear: both;
}

SMACSS | Scalable and Modular Architecture for CSS

At the very core of SMACSS is categorization. By categorizing CSS rules, we begin to see patterns and can define better practices around each of these patterns.

There are five types of categories:

  1. Base
    • default rules.
  2. Layout
    • divides the page into sections. Layouts hold one or more modules together.
  3. Modules
    • reusable, modular parts of design. They are the callouts, the sidebar sections, the product lists and so on.
  4. State
    • ways to describe how modules or layouts will look when in a particular state. Is it hidden or expanded? Is it active or inactive? They are about describing how a module or layout looks on screens that are smaller or bigger. They are also about describing how a module might look in different views like the home page or the inside page.
  5. Theme
    • similar to state rules in that they describe how modules or layouts might look. Most sites don’t require a layer of theming but it is good to be aware of it.

CSS Grid Layout

CSS Grid Layout is a 2-dimensional system, meaning it can handle both columns and rows, unlike flexbox which is largely a 1-dimensional system.

Back to ReadMe