Slide 1

Slide 1 text

CSS Layout WITH

Slide 2

Slide 2 text

HTML5 The 5th revision of HTML CSS3 New JavaScript APIs + +

Slide 3

Slide 3 text

CSS3

Slide 4

Slide 4 text

https://en.wikipedia.org/wiki/HTML5

Slide 5

Slide 5 text

Semantics Connectivity Offline & Storage Multimedia 3D graphics & effects Performance & Integration Device Access Styling https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5

Slide 6

Slide 6 text

Semantics Styling

Slide 7

Slide 7 text

Semantics Styling , , , , , , , , , …

Slide 8

Slide 8 text

Semantics Styling body div id=“header” div id=“sidebar” div id=“content” div class=“article” div class=“article” div id=“footer” body header aside section article article footer HTML4 HTML5

Slide 9

Slide 9 text

Semantics Styling Simplified DOCTYPE

Slide 10

Slide 10 text

Semantics Styling Compare with HTML 4.01: Simplified DOCTYPE

Slide 11

Slide 11 text

Semantics Styling

Slide 12

Slide 12 text

Semantics Styling

Slide 13

Slide 13 text

Semantics Styling

Slide 14

Slide 14 text

https://en.wikipedia.org/wiki/Cascading_Style_Sheets

Slide 15

Slide 15 text

• Selector • Box Model • Backgrounds & Border • Text Effects • 2D/3D Transformations • Animations • Multiple Column Layout

Slide 16

Slide 16 text

box-radius: 5px; Box radius

Slide 17

Slide 17 text

box-radius: 50%; Box radius

Slide 18

Slide 18 text

box-shadow: 1px 1px 0px pink; Box shadow

Slide 19

Slide 19 text

box-shadow: 1px 1px 0px pink, -1px -1px 0px green; Box shadow

Slide 20

Slide 20 text

text-shadow: 1px 1px 0px pink; Hello Hello Text shadow

Slide 21

Slide 21 text

h1:before, h1:after { content: “*”; color: pink; } *Hello* Pseudo elements

Slide 22

Slide 22 text

@font-face { font-family: “PilGi”; src: “PilGi.otf”; } h1 { font-family: “PilGi”; } Hello Web fonts

Slide 23

Slide 23 text

#container { background: #fff; display: flex; width: 900px; height: 400px; } Flexible Boxes #container

Slide 24

Slide 24 text

Flexible Boxes #container #main { background: pink; } #right-col { background: green; } #main #right-col #container { background: #fff; display: flex; width: 900px; height: 400px; }

Slide 25

Slide 25 text

Flexible Boxes #container #main { background: pink; width: 600px; } #right-col { background: green; } #main #right-col #container { background: #fff; display: flex; width: 900px; height: 400px; }

Slide 26

Slide 26 text

Flexible Boxes #container #main { background: pink; width: 600px; } #right-col { background: green; flex: 1; } #main #right-col #container { background: #fff; display: flex; width: 900px; height: 400px; }

Slide 27

Slide 27 text

Transitions div { width: 100px; } div:hover { width: 800px; }

Slide 28

Slide 28 text

Transitions div { width: 100px; } div:hover { width: 800px; }

Slide 29

Slide 29 text

Transitions div { width: 100px; transition: width 2s ease-in-out; } div:hover { width: 800px; }

Slide 30

Slide 30 text

Transitions div { width: 100px; transition: width 2s ease-in-out; } div:hover { width: 800px; }

Slide 31

Slide 31 text

Transforms Hi div { transform: rotate(45deg); }

Slide 32

Slide 32 text

Don’t forget vendor prefixes -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg);

Slide 33

Slide 33 text

Preprocessors

Slide 34

Slide 34 text

Preprocessors .css .css .styl .sass .scss .less Myth Less Sass Stylus Postcss

Slide 35

Slide 35 text

Preprocessors

Slide 36

Slide 36 text

Question?

Slide 37

Slide 37 text

CSS Layout

Slide 38

Slide 38 text

FLEXBOX

Slide 39

Slide 39 text

10+ 22+ 21+ 6.1+ 12.1+ http://caniuse.com/#search=flexbox -webkit-

Slide 40

Slide 40 text

DEFINITION The main idea is to give the “container” the ability to change the width & height of its children to best fill the blank space and prevent overflow.

Slide 41

Slide 41 text

TERMINOLOGY Flex Container 1 2 3 Flex Items

Slide 42

Slide 42 text

PROPERTIES Flex Container Flex Item ✦ display ✦ flex-direction ✦ flex-wrap ✦ flex-flow ✦ justify-content ✦ align-items ✦ … ✦ order ✦ flex-grow ✦ flex-shrink ✦ flex-basis ✦ align-self

Slide 43

Slide 43 text

GET STARTED
1
2
3
Flex Items Flex Container

Slide 44

Slide 44 text

WITHOUT FLEXBOX 1 2 3

Slide 45

Slide 45 text

WITH FLEXBOX .container { display: flex; } 1 2 3

Slide 46

Slide 46 text

FLEX-CONTAINER PROPERTIES

Slide 47

Slide 47 text

flex-direction 1 2 3 row default 3 2 1 row-reverse

Slide 48

Slide 48 text

flex-direction 1 2 3 column 3 2 1 column-reverse

Slide 49

Slide 49 text

flex-wrap nowrap default 1 2 3 4 5 6 wrap 1 2 3 4 5 6 wrap-reverse 1 2 3 4 5 6

Slide 50

Slide 50 text

flex-flow row nowrap default 1 2 3 4 5 6 flex-direction

Slide 51

Slide 51 text

ALIGMENT align-items justify-content cross-axis main-axis

Slide 52

Slide 52 text

justify-content flex-start default 1 2 3 4 flex-end 1 2 3 4

Slide 53

Slide 53 text

justify-content center 1 2 3 4

Slide 54

Slide 54 text

justify-content space-between 1 2 3 4 space-around 1 2 3 4

Slide 55

Slide 55 text

align-items stretch default 1 2 3 4 flex-start 1 2 3 4

Slide 56

Slide 56 text

align-items flex-end center 1 2 3 4 1 2 3 4

Slide 57

Slide 57 text

align-items baseline 1 2 3 4

Slide 58

Slide 58 text

align-content stretch default 1 2 3 4 5 6 7 8 9

Slide 59

Slide 59 text

align-content flex-start 1 2 3 4 5 6 7 8

Slide 60

Slide 60 text

align-content flex-end 1 2 3 4 5 6 7 8

Slide 61

Slide 61 text

align-content center 1 2 3 4 5 6 7 8

Slide 62

Slide 62 text

align-content space-between 1 2 3 4 5 6 7 8

Slide 63

Slide 63 text

align-content space-around 1 2 3 4 5 6 7 8

Slide 64

Slide 64 text

1 2 3 FLEX-ITEMS PROPERTIES

Slide 65

Slide 65 text

order {number} 3 1 2 4 .item3 { order: -1; }

Slide 66

Slide 66 text

flex-grow {number} 1 2 3 4 .item2 { flex-grow: 2; }

Slide 67

Slide 67 text

flex-shrink {number} 1 2 3 4 .item2 { flex-shrink: 2; }

Slide 68

Slide 68 text

flex-basis {size} 1 2 3 4 .item1 { flex-basis: 20px; }

Slide 69

Slide 69 text

flex {number} 1 2 3 4 .item { flex: 0 1 auto; } flex-grow

Slide 70

Slide 70 text

align-self 1 2 3 4 .item1 { align-self: flex-start; } .item2 { align-self: stretch; } .item3 { align-self: flex-end; } .item4 { align-self: center; } default:auto

Slide 71

Slide 71 text

Header Footer Body Aside 1 Aside 2 http://codepen.io/cesar2535/pen/KpYqwd

Slide 72

Slide 72 text

RESOURCES Learn • https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties • https://css-tricks.com/snippets/css/a-guide-to-flexbox/ • http://heydesigner.com/flexbox/ • http://philipwalton.github.io/solved-by-flexbox/ • http://sixrevisions.com/css/learn-flexbox/ Bugs • https://github.com/philipwalton/flexbugs

Slide 73

Slide 73 text

Question? THANK!