#4 - css selectors, css3 and web typography

35
Tecniche di animazione digitale 1

Upload: iloveigloo

Post on 14-May-2015

712 views

Category:

Documents


0 download

DESCRIPTION

- CSS selectors - CSS3 - Web typography

TRANSCRIPT

Page 1: #4 - CSS Selectors, CSS3 and Web typography

Tecniche di animazionedigitale 1

Page 2: #4 - CSS Selectors, CSS3 and Web typography

Michele BertoliFounder / Lead Software Engineer at Igloo

[email protected]

Tecniche di animazionedigitale 1

Page 3: #4 - CSS Selectors, CSS3 and Web typography

Basic 4December 12, 2012

Page 4: #4 - CSS Selectors, CSS3 and Web typography

Agenda

CSS selectors

CSS3

Web typography

5

10

40

Page 5: #4 - CSS Selectors, CSS3 and Web typography

CSS selectors

Page 6: #4 - CSS Selectors, CSS3 and Web typography

CSS selectors

● #id● .class● element

6 Basic / CSS selectors

Page 7: #4 - CSS Selectors, CSS3 and Web typography

CSS selectors

● element element

● element > element: select elements with a specific parent.

● element + element: select elements that is placed immediately after (not inside) the first specified element.

7 Basic / CSS selectors

http://jsfiddle.net/MicheleBertoli/pvUnR

http://jsfiddle.net/MicheleBertoli/xRQwD

Page 8: #4 - CSS Selectors, CSS3 and Web typography

CSS selectors

● attribute● [attribute=value]● [attribute~=value]: select elements with an attribute

value containing a specified word.● [attribute|=value]: select elements with the specified

attribute starting with the specified value.

8 Basic / CSS selectors

http://jsfiddle.net/MicheleBertoli/uBxsU

Page 9: #4 - CSS Selectors, CSS3 and Web typography

CSS selectors

● :link● :visited● :active● :hover● :focus

9 Basic / CSS selectors

● :first-letter● :first-line● :first-child● :before● :after

http://jsfiddle.net/MicheleBertoli/xu95F

Page 10: #4 - CSS Selectors, CSS3 and Web typography

Priority level of selector

● style attribute = a● number of ID attributes in the selector = b● number of other attributes and pseudo-classes in the

selector = c● number of element names and pseudo-elements in the

selector = d

10 Basic / CSS selectors

Page 11: #4 - CSS Selectors, CSS3 and Web typography

Efficiency● ID, e.g. #header● Class, e.g. .promo● Type, e.g. div● Adjacent sibling, e.g. h2 + p● Child, e.g. li > ul● Descendant, e.g. ul a● Universal, i.e. *● Attribute, e.g. [type="text"]● Pseudo-classes/-elements, e.g. a:hover

11 Basic / CSS selectors

Page 12: #4 - CSS Selectors, CSS3 and Web typography

CSS3

Page 13: #4 - CSS Selectors, CSS3 and Web typography

Introduction

Cascading Style Sheets is a style sheet language used for

describing the presentation semantics (the look and

formatting) of a document written in a markup language.

13 Basic / CSS3

Page 14: #4 - CSS Selectors, CSS3 and Web typography

CSS3 modules

CSS3 is split up into "modules".

Some of the most important CSS3 modules are:

14 Basic / CSS3

● Selectors● Box Model● Backgrounds and Borders● Text Effects● 2D/3D Transformations● Animations● Multiple Column Layout● User Interface

Page 15: #4 - CSS Selectors, CSS3 and Web typography

CSS3 selectors

● element1 ~ element2: matches occurrences of element2 that are preceded by element1.

● [attribute^=value]: matches every element whose attribute value begins with a specified value.

● [attribute$=value]: matches every element whose attribute value ends with a specified value.

● [attribute*=value]: matches every element whose attribute value containing a specified value.

15 Basic / CSS3

http://jsfiddle.net/MicheleBertoli/uBxsU/1

Page 16: #4 - CSS Selectors, CSS3 and Web typography

CSS3 selectors

● :first-of-type● :last-of-type● :only-of-type

16 Basic / CSS3

http://jsfiddle.net/MicheleBertoli/uBxsU/2

Page 17: #4 - CSS Selectors, CSS3 and Web typography

CSS3 selectors

● :only-child● :nth-child(n)● :nth-last-child(n)● :nth-of-type(n)● :nth-last-of-type(n)● :last-child

17 Basic / CSS3

http://jsfiddle.net/MicheleBertoli/uBxsU/3

Page 18: #4 - CSS Selectors, CSS3 and Web typography

CSS3 selectors

● :root● :empty● :target● :enabled● :disabled● :checked● :not(selector)● ::selection

18 Basic / CSS3

Page 19: #4 - CSS Selectors, CSS3 and Web typography

Border radius

19 Basic / CSS3

div

{

border:5px solid #ccc;

border-radius:10px;

}

http://jsfiddle.net/MicheleBertoli/Akt8x

Page 20: #4 - CSS Selectors, CSS3 and Web typography

Box shadow

20 Basic / CSS3

div

{

box-shadow:10px 10px 5px #ccc;

}

http://jsfiddle.net/MicheleBertoli/2BLt5

Page 21: #4 - CSS Selectors, CSS3 and Web typography

Text shadow

21 Basic / CSS3

h1

{

text-shadow:5px 5px #ccc;

}

http://jsfiddle.net/MicheleBertoli/nv8LL

Page 22: #4 - CSS Selectors, CSS3 and Web typography

PrefixFree

-prefix-free lets you use only unprefixed CSS properties

everywhere. It works behind the scenes, adding the current

browser’s prefix to any CSS code, only when it’s needed.

22 Basic / CSS3

http://leaverou.github.com/prefixfree

Page 23: #4 - CSS Selectors, CSS3 and Web typography

Coffee Break

Page 24: #4 - CSS Selectors, CSS3 and Web typography

Web typography

Page 25: #4 - CSS Selectors, CSS3 and Web typography

Introduction

Web typography refers to the use of fonts on the World Wide

Web.

25 Basic / Web typography

Page 26: #4 - CSS Selectors, CSS3 and Web typography

Properties

● font-family● font-style● font-variant● font-weight● font-size

26 Basic / Web typography

Page 27: #4 - CSS Selectors, CSS3 and Web typography

Line height

On inline elements, the line-height CSS property specifies the

height that is used in the calculation of the line box height.

On block level elements, line-height specifies the minimal

height of line boxes within the element.

27 Basic / Web typography

line-height:20px;

http://jsfiddle.net/MicheleBertoli/b3bRb

Page 28: #4 - CSS Selectors, CSS3 and Web typography

Web-safe fonts

Web-safe fonts are fonts likely to be present on a wide range

of computer systems, and used by Web content authors to

increase the likelihood that content will be displayed in their

chosen font.

28 Basic / Web typography

Page 29: #4 - CSS Selectors, CSS3 and Web typography

@font-face

@font-face is a css rule which allows you to download a

particular font from your server to render a webpage if the

user hasn't got that font installed.

29 Basic / Web typography

Page 30: #4 - CSS Selectors, CSS3 and Web typography

Formats

● WOFF (Web Open Font Format) .woff● TrueType .ttf● OpenType .ttf, .otf● Embedded OpenType .eot● SVG Font .svg, .svgz

30 Basic / Web typography

Page 31: #4 - CSS Selectors, CSS3 and Web typography

Browser support

Internet Explorer only supports EOT

Mozilla browsers support OTF and TTF

Safari and Opera support OTF, TTF and SVG

Chrome supports TTF and SVG.

31 Basic / Web typography

Page 32: #4 - CSS Selectors, CSS3 and Web typography

Usage

@font-face

{

font-family:myFirstFont;

src:url("Sansation_Light.ttf"),

url("Sansation_Light.eot");

}

div

{

font-family:myFirstFont;

}

32 Basic / Web typography

Page 33: #4 - CSS Selectors, CSS3 and Web typography

Google web fonts

Google web fonts makes it quick and easy for everyone to use

web fonts, including professional designers and developers.

33 Basic / Web typography

<link rel="stylesheet" type="text/css" href="http://fonts.

googleapis.com/css?family=Tangerine">

<style>

body

{

font-family:"Tangerine", serif;

}

</style>

Page 34: #4 - CSS Selectors, CSS3 and Web typography

Samples

34 Basic / Web typography

http://www.alistapart.com

http://theharrietseries.com

http://blakeallendesign.com

http://aworkinglibrary.com

http://informationarchitects.net

Page 35: #4 - CSS Selectors, CSS3 and Web typography

Thank you