css - memberclickscss •html = content •css = display •it’s important to keep them separated...

94
CSS Patrick Behr

Upload: others

Post on 31-Mar-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

CSSPatrick Behr

Page 2: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

CSS

• HTML = content

• CSS = display

• It’s important to keep them separated• Less code in your HTML

• Easy maintenance

• Allows for different mediums• Desktop

• Mobile

• Print

• Braille

Page 3: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Zen Garden

• CSS Zen Garden

Page 4: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Styles in HTML

• Browser• Browser wars

Page 5: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Styles in HTML

• Browser• Browser wars

• HTML elements• <FONT>

• <CENTER>

• <MARQUEE>

• <BLINK>

Page 6: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Styles in HTML

• Browser• Browser wars

• HTML elements• <FONT>

• <CENTER>

• <MARQUEE>

• <BLINK>

• CSS• CSS1=1996, CSS2=1998, CSS3=Ongoing

Page 7: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

• Style attribute•

CSS in HTML

Page 8: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

• Style attribute•

• Style element (inline style sheet)

CSS in HTML

Page 9: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

• Style attribute•

• Style element (inline style sheet)

• External Style Sheets •

CSS in HTML

Page 10: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Cascading

• Allows multiple styles

Page 11: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Cascading

• Allows multiple styles

• Precedence• Browser

Page 12: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Cascading

• Allows multiple styles

• Precedence• Browser

• Order

H1 {color : yellow;}

H1 {color : red;}

H1 {color : blue;}

Page 13: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

• Allows multiple styles

• Precedence• Browser

• Order

• Specificity• Type selector

Cascading

body {color : yellow;}

div {color : red;}

p {color : blue;}

Page 14: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Cascading

• Allows multiple styles

• Precedence• Browser

• Order

• Specificity• Type selector

• Class selector

p {color : lightblue;}

.dark {color : darkblue;}

Page 15: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Cascading

• Allows multiple styles

• Precedence• Browser

• Order

• Specificity• Type selector

• Class selector

• ID selector

p {color : lightblue;}

.dark {color : darkblue;}

#first {color : red;}

Page 16: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Cascading

• Allows multiple styles

• Precedence• Browser

• Order

• Specificity• Type selector

• Class selector

• ID selector

• Inline

h1 {color : blue;}

Page 17: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Cascading

• Allows multiple styles

• Precedence• Browser

• Order

• Specificity• Type selector

• Class selector

• ID selector

• Inline

• !important

h1 {color : blue !important}

Page 18: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Rules

• Made up of • Selector

• Declaration• Property

• Value

h1 { color: yellow; }

Page 19: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Rules

• Made up of • Selector

• Declaration• Property

• Value

h1 { color: yellow; }

Page 20: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Rules

• Made up of • Selector

• Declaration• Property

• Value

h1 { color: yellow; }

Page 21: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Rules

• Made up of • Selector

• Declaration• Property

• Value

h1 { color: yellow; }

Page 22: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Rules

• Made up of • Selector

• Declaration• Property

• Value

h1 { color: yellow; }

Page 23: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Selectors

• Type selector h1 {color: blue}

Page 24: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Selectors

• Type selector

• Class selector

h1 {color: blue}

.required {border: solid red}

Page 25: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Selectors

• Type selector

• Class selector

• ID selector

h1 {color: blue}

.required {border: solid red}

#error {color: red}

Page 26: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Selectors

• Type selector

• Class selector

• ID selector

• Grouping

h1 {color: blue}

.required {border: solid red}

#error {color: red}

h1, h2, h3 {color: blue}

Page 27: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Selectors

• Type selector

• Class selector

• ID selector

• Grouping

• Descendant

h1 {color: blue}

.required {border: solid red}

#error {color: red}

h1, h2, h3 {color: blue}

ul li a {text-decoration:none}

Page 28: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Selectors

• Type selector

• Class selector

• ID selector

• Grouping

• Descendant

• Child

h1 {color: blue}

.required {border: solid red}

#error {color: red}

h1, h2, h3 {color: blue}

header > h1 {color: blue}

article > h1 {color: blue}

ul li a {text-decoration:none}

Page 29: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Selectors

• Type selector

• Class selector

• ID selector

• Grouping

• Descendant

• Child

• Adjacent

h1 {color: blue}

.required {border: solid red}

#error {color: red}

h1, h2, h3 {color: blue}

header > h1 {color: blue}

article > h1 {color: blue}

ul li a {text-decoration:none}

h1 + p {color: blue}

Page 30: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Selectors

• Grouping article, aside, details,

figcaption, figure, footer,

header, hgroup, menu, nav,

section {display : block}

Page 31: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Selectors

• Descendant div {color : green;}

p {color : blue;}

div p {color : orange;}

Page 32: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Selectors

• Combinations p {color : blue;}

.bright {color : yellow;}

div.bright {color : red;}

Page 33: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Selectors

• Combinations article > h1 + p {

color : blue;

}

Page 34: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Menu

• Unordered List

• List Items

• Anchors

Page 35: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Menu

• Remove underlines ul li a {

text-decoration : none;

}

Page 36: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Menu

• Remove the bullets ul li {

list-style-type : none;

}

Page 37: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Menu

• List horizontally ul li {

list-style-type : none;

display : inline;

}

Page 38: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Menu

• Add a border ul li {

list-style-type : none;

display : inline;

border : 1px solid black;

}

Page 39: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Menu

• Add a little padding ul li {

list-style-type : none;

display : inline;

border : 1px solid black;

padding : 2px;

}

Page 40: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Menu

• Mouse over/Hover ul li:hover {

background-color : lightgray;

}

Page 41: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Declarations

• General• height (min & max) specifies the height of an element

• width (min & max) specifies the width of an element

• padding padding between content & border

• margin sets the margin between elements

• position alternative element positioning

Page 42: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Declarations

• Background• background-color sets a background color

• background-image adds a background image

• background-attachment determines the image position

• background-repeat determines if images are repeated

Page 43: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Declarations

• Border• border-width sets the width of the border

• border-style sets the line style of the border

• border-color sets the line color of the border

Page 44: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Declarations

• Font• color sets the foreground color

• font-family sets the font type

• font-size sets the size of the font

• font-style applies italics or oblique

• font-weight sets the boldness of the font

• line-height sets the minimum height of line

• text-align text alignment within an element

Page 45: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Declarations

• font-family

font-family: Cambria, Times, "Times New Roman", serif;

font-family: Calibri, Tahoma, Helvetica, Arial, sans-serif;

font-family: Consolas, "Courier New", Courier, monospace;

Page 46: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Media Query

• Apply specific presentation for specific output devices

• Same content

• Different CSS for desktop, mobile, print• Fluid/Responsive design

Page 47: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Media Query

• Media type• all | print | screen | speech

• Media features• width

• height

• hover

Page 48: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Media Type

• Set font for print

• Set font for screen

@media print {

body {font-size : 10pt}

}

@media screen {

body {font-size : 14pt}

}

Page 49: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Media features

• Screen <= 600px

• Screen >= 600px

@media (max-width:600px) {

body {font-size : 10pt}

}

@media (min-width:600px) {

body {font-size : 14pt}

}

Page 50: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Media features

• Menu ul li {

list-style-type : none;

border : 1px solid black;

padding : 2px;

}

@media (min-width:250px) {

ul li {display : inline;}

}

Page 51: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Media features

• Menu

Page 52: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Media features

• Menu

Page 53: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Box Model

• Each element is represented as a box

• The box model describes the space taken by the element

• 4 edges• Content

• Padding

• Border

• Margin

Page 54: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Box Model

Margin

Border

Padding

Content

Page 55: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Box Model

Page 56: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Box Model

span {

border : 1px solid black;

}

Page 57: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Box Model

span {

margin : 10px;

}

Page 58: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Box Model

span {

padding : 10px;

}

Page 59: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 60: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 61: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 62: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 63: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 64: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 65: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 66: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 67: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 68: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 69: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 70: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float

Page 71: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float – 2 column layout

Page 72: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float – 2 column layout

Page 73: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float – 2 column layout

Page 74: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Float – 2 column layout

Page 75: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Flexbox

• Layouts used floats and positioning

• Things that were a real pain:• Vertically centering content inside its parent

• Making elements use equal amount of the available width/height

• Making all columns the same height if they contain a different amount of content

• Flexbox fixes that

Page 76: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Flexbox

Aligns and evenly spaces items inside a container

Container

Item Item Item Item

Page 77: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Flexbox

Container

Item Item Item Item

container { flex-direction: row }

Page 78: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Flexbox

container { flex-direction: row-reverse }

Container

Item Item Item Item

Page 79: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Flexbox

Container

Item

Item

container { flex-direction: column }

Item

Item

Page 80: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Flexbox

Container

Item

Item

container { flex-direction: column-reverse }

Item

Item

Page 81: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Flexbox

Container

Item Item Item Item

container { flex-wrap: wrap }

Item Item Item Item

Page 82: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Grids

• A grid breaks the page up into rows and columns

• Native CSS grids are on the way!

• 3rd party grid systems (search “CSS Grid framework”)• Bootstrap

• Flexbox Grid

• Skeleton

Page 83: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Grids

A container element represents the entire grid (.container)

Page 84: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Grids

A parent element represents each row (.row)

Page 85: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Grids

Apply classes to elements to determine how many columns wide

.col-3 .col-2.col-7

Page 86: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Grids

A parent element represents each row (.row)

.col-3 .col-2.col-7

Page 87: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Grids

Apply classes to elements to determine how many columns wide

.col-6

.col-3 .col-2.col-7

.col-3 .col-3

Page 88: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Grids

A parent element represents each row (.row)

.col-3 .col-2.col-7

.col-6.col-3 .col-3

Page 89: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Grids

Apply classes to elements to determine how many columns wide

.col-6

.col-3 .col-2.col-7

.col-3 .col-3

.col-4.col-8

Page 90: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Pre-processors

• Adds functionality to CSS

• Variables

• Nesting

• Mixins

• Pre-processors:• SASS - written in Ruby

• LESS – written in JavaScript

• Others

Page 91: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Pre-processors

• Variables

$font-stack: Arial, Helvetica, sans-serif;

$main-color: #cc4123;

body {

color: $main-color;

font : $font-stack;

}

Page 92: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Pre-processors

• Nesting

nav {

border: 1px solid black;

}

nav ul {

list-style: none;

}

nav ul a {

text-decoration: none;

}

Page 93: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Pre-processors

• Nesting

nav {

border: 1px solid black;

ul {

list-style: none;

a {

text-decoration: none;

}

{

}

Page 94: CSS - MemberClicksCSS •HTML = content •CSS = display •It’s important to keep them separated •Less code in your HTML •Easy maintenance •Allows for different mediums •Allows

Avoid Spaghetti Code

• SMACCS – Scalable and Modular Architecture for CSS• Base, Layout, Module, State, Theme

• https://smacss.com/

• BEM – Block, Element, Modifier• menu, menu item, a disable menu item

• http://getbem.com/

• OOCSS – Object Oriented CSS• https://github.com/stubbornella