Introduction to CSS3

45
Introduction to CSS3 Doris Chen Ph.D. Developer Evangelist Microsoft http://blogs.msdn.com/dorischen/

description

This presentation is target for developers that are new to CSS3, and would like to know what CSS3 they need to understand for Windows 8 development.

Transcript of Introduction to CSS3

Page 1: Introduction to CSS3

Introduction to CSS3

Doris Chen Ph.D.

Developer Evangelist

Microsoft

http://blogs.msdn.com/dorischen/

Page 2: Introduction to CSS3

Agenda

What is CSS3?

Media Queries

Advanced Layout

Tools

Summary and Resources

Page 3: Introduction to CSS3

What’s is CSS3?

Page 4: Introduction to CSS3

What is CSS used for now?

Layout

Colors

Fonts and text

Backgrounds

Borders

Floats

Page 5: Introduction to CSS3

The Fundamentals

Elements

Attributes

Selectors

Properties

5

Page 6: Introduction to CSS3

Why Should I Care?

Key technology in the HTML5 family

Benefits Improve response times

Less reliance on JavaScript and plug-ins

Less site maintenance

Good Patterns Progressive enhancement

Adaptive design

A new audience for us

Page 7: Introduction to CSS3

What is CSS3?

HTML CSS Web Apps SVG

Geo

loca

tio

n

EC

MA

Last update: June 13, 2011

7

Page 8: Introduction to CSS3

What is CSS3?

Defines visual appearance

of webpages

Divided into over 50

modules

Vendor prefixes used to

specify browser

extensions -ms-

-moz-

-webkit- HTML CSS Web Apps SVG

Geo

loca

tio

n

EC

MA

PAGE 8

Page 9: Introduction to CSS3

What’s New in CSS3? 2D Transforms

Backgrounds & Borders

Color

Values and Units

Selectors

Web Fonts

Media Queries

Namespaces

3D Transforms

Animations

Gradient

CSS Exclusions (Floats)

Flexible Box (“Flexbox”)

Layout

Grid Layout

Multi-column Layout

Region

SVG Filter Effects

Text Shadow

Transitions

PAGE 9

Page 10: Introduction to CSS3

Media Queries

Page 11: Introduction to CSS3

A look…

11

Page 12: Introduction to CSS3

Media Queries

Examine device properties to determine optimal delivery and placement of content

The CSS3 Media Queries Module specifies methods to enable web developers to scope a style sheet to a set of precise device capabilities.

Adapt output based on media type The Desktop Browser, Screen, Print

Mobile Browsers

Tablet form-factors

Televisions

Game Consoles

Page 13: Introduction to CSS3

Media Queries Samples @media screen and (max-width: 600px) {

body {

font-size: 80%;

}

}

@media screen and (min-width:320px) and (max-width:480px)

@media not print and (max-width:600px)

Page 14: Introduction to CSS3

Supported Media Properties

min/max-width

min/max-height

device-width

device-height

orientation

aspect-ratio

device-aspect-ratio

color

color-index

monochrome

resolution

PAGE 14

Page 15: Introduction to CSS3

http://mediaqueri.es

15

Page 16: Introduction to CSS3

View States

Page 17: Introduction to CSS3
Page 18: Introduction to CSS3

Blog http://blogs.msdn.com/dorischen

device-portrait

/* Re-arrange and hide/show content */

full-screen

snapped

fill

Full screen

Snap

Fill

Portrait

Page 19: Introduction to CSS3

Media Queries: Portrait View Before After

19 Space is used more efficiently after apply all css rules in Media Queries

Page 20: Introduction to CSS3

Advanced Layout

Page 21: Introduction to CSS3

Manage the wireframe

Page 22: Introduction to CSS3

22

Page 23: Introduction to CSS3

CSS 3 flexible box layout

• Define direction and

ordering of flexible

box items

• Define how to

distribute and share

free space to flexibly

space and size

elements

• Align items

horizontally or

vertically

• display: flexbox

• -ms-box-direction

• -ms-box-orient

• -ms-box-ordinal-

group

• -ms-box-line-

progression

• -ms-box-lines

• -ms-box-pack

• -ms-box-flex

• -ms-box-align

Page 24: Introduction to CSS3

CSS 3 flexible box layout uses

Build simple designs that partition space vertically or horizontally

Align related elements and distribute available space

Perfect for menus, lightweight collections, or simple designs

Page 25: Introduction to CSS3

Grid Layout

Organizes a webpage by dividing space into major regions

Allows elements to align into columns and rows without the use of tables

Enables a variety of layouts Span columns or rows

Overlap

Layer

Adapts to changes due to Media

Orientation

Available space

Page 26: Introduction to CSS3

CSS3 grid layout

Create a grid and

define grid rows and

columns

Place grid items within

the grid rows and

columns

Define flexible row,

column sizing

Align grid children

display: grid

-ms-grid-columns

-ms-grid-rows

-ms-grid-column

-ms-grid-row

-ms-grid-column-span

-ms-grid-row-span

-ms-grid-column-align

-ms-grid-row-align

Page 27: Introduction to CSS3

Grid Layout

1

2

3

27

Page 28: Introduction to CSS3

28

Page 29: Introduction to CSS3

CSS3 grid layout uses

Enables you to easily design grid-aligned apps that partition space vertically and horizontally

Uses declarative styles to create clean designs that can be easily adapted to multiple resolutions

Allows you to specify positions independent of content order

Perfect for more complex Metro style apps

Page 30: Introduction to CSS3

Multi-Column Layout

Layout content in multiple columns without the use of tables

Content can flow from one column to another

Columns are separated by a gap and rule

Page 31: Introduction to CSS3

Multi-Column Layout

31

Page 32: Introduction to CSS3

CSS3 multiple column layout

• Break text across multiple columns

• Specify column gaps

• Enable and style column rules

• column-count

• column-width

• column-gap

• column-rule-color

• column-rule-style

• column-rule-width

Page 33: Introduction to CSS3

33

Page 34: Introduction to CSS3

Thinking About Adaptability

Manage Device Families CSS3 Media Queries

Manage Real Estate CSS3 Grid Layout

Adaptive Components CSS3 FlexBox

CSS3 Multi-Column

Page 35: Introduction to CSS3

CSS3

Page 36: Introduction to CSS3

Tools

Page 37: Introduction to CSS3
Page 38: Introduction to CSS3

The development tools are FREE!

If you use a higher SKU, it just works!

Page 39: Introduction to CSS3

39

Blend five ways: Visual Design Tool Layout

Visual sizing & re-

parenting, CSS3 grids,

element management

Styling

Responsive design, rich

value editors for CSS3

properties

Debug HTML

Live DOM, inspect both

markup and live values

Debug CSS

Cascade, computed values,

“Winning Properties”

JavaScript

Runs on the design

surface – you are styling

the live application.

Page 40: Introduction to CSS3

Summary

Page 41: Introduction to CSS3

Summary

Leverage CSS3 to design Windows 8 apps more easily

Think about Responsive Web Design

Manage Device Families

Media Queries

CSS3 Grid and CSS3 flexible box to design elegant and flexible apps

Adaptive Components

Positioned floats, CSS3 multiple columns, for beautiful text-centric designs

Page 42: Introduction to CSS3

Resources

Page 44: Introduction to CSS3

Windows 8 RTM Resources

Windows 8 and Tools Download http://bit.ly/Wins8Download

Windows 8 Cheat Sheet http://bit.ly/wins8cheatsheet

Develop Windows 8 in 30 Days with Consulting& Support http://bit.ly/Win8GenApp

Free Windows 8 training & Hackathon Events http://bit.ly/wins8Hackathon

Windows 8 Dev Center http://dev.windows.com

Page 45: Introduction to CSS3

IE Test Drive ietestdrive.com

PAGE 45