Skip to content

Instantly share code, notes, and snippets.

@kowsheek
Last active February 27, 2018 01:34
Show Gist options
  • Save kowsheek/e6708cdfbb7bba5a8e2cc2a32a52c779 to your computer and use it in GitHub Desktop.
Save kowsheek/e6708cdfbb7bba5a8e2cc2a32a52c779 to your computer and use it in GitHub Desktop.

Warmup

  • Concepts as experiments
  • CSS is tough
    • Browsers support
    • Focus on using Chrome only
    • Chrome DevTools = best friend
  • SASS/SCSS covered later in the week
  • Bootstrap is to be experimented with
  • Box-model
    • Not perfect but powerful
    • Flexbox is improving on it

HTML

  • Role of HTML
  • div
  • main
  • section, article, header, footer, nav
  • Class, name & id

CSS

  • Role of CSS
  • Box-model
    • Each element defined as a box of several edges that contain regions:
      • Content
      • Padding
      • Border
      • Margin
Margin
+--------------------------------------+
|  Border                              |
|  +-------------------------------+   |
|  |  Padding                      |   |
|  |  +-------------------------+  |   |
|  |  |                         |  |   |
|  |  | Content                 |  |   |
|  |  | +-------------------+   |  |   |
|  |  | | Content goes Here |   |  |   |
|  |  | +-------------------+   |  |   |
|  |  |                         |  |   |
|  |  +-------------------------+  |   |
|  |                               |   |
|  +-------------------------------+   |
+--------------------------------------+

  • Content box vs border box
  • Using box-sizing: content-box setting the width, height related properties set the size of the content region to the given values
  • Using box-sizing: border-box setting the width, height related properties set the size of the border region to the given values

In this example, content-box would have a width of 216px but border-box would have the width of 200px;

.content-box {
  width: 200px;
  height: 100px;
  padding: 8px 4px;
}

.border-box {
  box-sizing: border-box;
  width: 200px;
  height: 100px;
  padding: 8px 4px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment