Git Product home page Git Product logo

css-mod2-lecture's Introduction

CSS Fundamentals

Objectives

  • Discuss what CSS does and why it's important
  • Cover the basics of HTML
  • Differentiate between inline, internal, and external stylesheets
  • Demonstrate the anatomy of a declaration block
  • Understand how to use class, id, and element selectors, and selector order of importance
  • Demonstrate the use of the box model
  • Demonstrate the use of CSS grid in page layout
  • Introduce CSS Frameworks like Bootstrap and Semantic UI

CSS Basics

What does CSS mean?
Cascading Stylesheets

Why do we use it? Makes the internet look pretty

The Good, the Bad and the Ugly

  • CSS Zen Garden:
    csszengarden.com

  • My Favorite:
    lingscars.com

The basics of HTML

  • Some elements need an opening and a closing tag.
    • <tag>Content</tag>
    • <h1>Heading</h1>
      • h1 - h6
    • <p>Paragraph</p>
  • You can nest elements within other elements.
    • <ul></ul> (Unordered list) / <ol></ol> (Ordered list)
      • <li>List Item</li>
    • <div></div> (block) / <span></span> (inline)
  • Some elements are self closing.
    • <tag />
    • <br />
    • <img />

Inline Styling

<tag style="property:value or values;”>

Internal Stylesheets

<head>
<meta…></meta>
<title…></title>
<style>
  tag {
    property: property value or values;
  }
</style>
</head>

Anatomy of the Declaration Block

selector(s) { property: value or values; property: value; }

Three Main Types of CSS Selectors

  • HTML tags/elements - Least specific
  • Classes
    • .class-name
  • Ids - Most specific
    • #id-name

Element Selector:

p {
  font-size: 20px;
}

Class Selector:

.navbar {
  margin-bottom: 0px;
}

ID Selector:

#main-page-title {
  font-family: sans-serif;
}

Selecting Multiple Elements:

p, .navbar, #main-page-title {
  color: green;
}

External Stylesheets

  • For an external stylesheet we have to add a link in the head that looks something like this:
<link rel="stylesheet" href="./stylesheet.css">

The Box Model

4 Elements of the box model:

  • Margin
  • Border
  • Padding
  • Content

Layouts & Positioning - CSS Grid / Flex

Flex-based layout system

  • Use this to organize your elements horizontally OR vertically
  • CSS Flexbox Froggy is a great resource for this! vvv

Grid-based layout system

  • Use this to organize your elements horizontally AND vertically all at once
  • CSS Grid Garden is a great resource for this! vvv

These properties make it easy to create well-designed and responsive pages

CSS Frameworks

Frameworks do a lot of the CSS work for us!!! You can style your website very quickly by using a framework, but there are some drawbacks.
Semantic UI Bootstrap
Materialize

Resources

Awwwards - For inspiration codrops - Fantastic resource for all things CSS
w3schools - Great HTML resource
w3schools - Great CSS resource
CSS Tricks - The best resource for learning and understanding flexbox and grid
CSS Grid Guide - Takes you straight to the grid page
CSS MDN - Another goodie
CSS Zen Garden - Great examples of some rock solid CSS experiences
Flexbox Froggy - THE BEST way to learn flex
CSS Grid Garden - THE BEST way to learn grid Code Pen - code examples with code sandbox CSS Grid Generator - Awesome tool to implement css grid quickly

css-mod2-lecture's People

Contributors

dwire avatar brewchetta avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.