html5 e css3 - 3 | webmaster & webdesigner

22
HTML5 e Css3 [1] Matteo Magni

Upload: matteo-magni

Post on 29-Nov-2014

367 views

Category:

Technology


1 download

DESCRIPTION

Terza lezione Modulo HTML5 e Css3 per il corso di WebMaster & WebDesigner

TRANSCRIPT

Page 1: HTML5 e Css3 - 3 | WebMaster & WebDesigner

HTML5 e Css3 [1]Matteo Magni

Page 2: HTML5 e Css3 - 3 | WebMaster & WebDesigner

Quale sono i problemi principali che incontrate quando scrivete i CSS2?

Page 3: HTML5 e Css3 - 3 | WebMaster & WebDesigner

● Gestione delle decorazioni

● Disordine nel markup html che ci tocca aggiungere

● Troppo Javascript per la presentazione

Problemi?

Page 4: HTML5 e Css3 - 3 | WebMaster & WebDesigner
Page 5: HTML5 e Css3 - 3 | WebMaster & WebDesigner

Gestione delle decorazioni

● Difficili da mantenere nel tempo● Ci occupano molta banda● Fare molte Request HTTP aggiunge lentezza● Il css è difficile da capire● Gli utenti spesso si trovano a vedere la pagina

senza di esse

Page 6: HTML5 e Css3 - 3 | WebMaster & WebDesigner

Opacity

div { color: #00c; opacity: 1.0; }! 

div { color: #00c; opacity: 0.5; }!

Page 7: HTML5 e Css3 - 3 | WebMaster & WebDesigner

HSLa

● Tonalità (Hue) ● Saturazione (Saturation)● Luminosità (Lightness)

● Trasparenza (alpha)

In aggiunta al RGBa ma forse più chiaro

Page 8: HTML5 e Css3 - 3 | WebMaster & WebDesigner
Page 9: HTML5 e Css3 - 3 | WebMaster & WebDesigner

● Esempi:● tonalità rossa useremo 0● per il giallo 60● per il verde 120

 #alpha {

    color: rgba(255,255,255,.8);

    background­color: hsla(200,100%, 50%, .5);

    border: 20px solid rgba(0,0,0,.3);

 }   

Page 10: HTML5 e Css3 - 3 | WebMaster & WebDesigner
Page 11: HTML5 e Css3 - 3 | WebMaster & WebDesigner

background-clip

 #alpha {

    color: rgba(255,255,255,.8);

    background­color: hsla(200,100%, 50%, .5);

    border: 20px solid rgba(0,0,0,.3);

    background­clip: padding­box;

 }   

Page 12: HTML5 e Css3 - 3 | WebMaster & WebDesigner

background-clip● border-box → lo sfondo si estende fino all'area del

bordo● padding-box → si estende nell'area del padding● content-box → solo nell'area del contenuto

Page 13: HTML5 e Css3 - 3 | WebMaster & WebDesigner

Bordi arrotondati History

//una volta ci servivano 4 immagini più un html di questo tipo

<div id="mainContent">

 <div id="bodyText">

 <p>Lorem ipsum dolor etc …</p>

 </div>

 <div id="contentBottom">

  <div id="innerBottom">&nbsp;</div><!­­ end #innerBottom ­­>

 </div><!­­ end #contentBottom ­­>

</div><!­­ end #mainContent →

/*css che usa 4 immagini degli angoli tondi*/

#contentBottom{

background:url("corner_bottom_left.gif") bottom left no­repeat;

  background­color:#dadada;

}

....

#innerBottom {

background:url("corner_bottom_right.gif") bottom right no­repeat;

}

Page 14: HTML5 e Css3 - 3 | WebMaster & WebDesigner

Bordi arrotondati

 #radius1 {

/*­webkit­border­radius: 12px;

  ­moz­border­radius: 12px;*/

  border­radius: 12px;

  border: 10px solid red;

  background­color:red;

}  

Page 15: HTML5 e Css3 - 3 | WebMaster & WebDesigner

Bordi arrotondati

 #radius2 {

 /*vertical radius*/

  border­radius: 12px/24px;

  border: 10px solid red;

  background­color:red;

}   

#radius3 {

 /*horizontal radius*/

  border­radius: 24px/12px;

  border: 10px solid red;

  background­color:red;

}

   

#radius4 {

/*top left, top right, bottom right, bottom left*/

border­radius: 40px 50% 10px 20%;

border: 10px solid red;

background­color:red;

}   

Page 16: HTML5 e Css3 - 3 | WebMaster & WebDesigner
Page 17: HTML5 e Css3 - 3 | WebMaster & WebDesigner

● border-top-left-radius● border-top-right-radius● border-bottom-right-radius● border-bottom-left-radius● border-radius

Supporto senza i prefissi proprietari

Page 18: HTML5 e Css3 - 3 | WebMaster & WebDesigner

Box-shadow

 #shadow1 {

box­shadow: 5px 5px 10px 2px blue;

}                

#shadow2 {         box­shadow: 5px 5px 10px 2px red;

Page 19: HTML5 e Css3 - 3 | WebMaster & WebDesigner

Box Shadow

1)spostamento in senso orizzontale

2)spostamento in senso verticale

3) il livello di sfocatura (blur radius)• Più grande più l'ombra sarà sfocata

4)livello di diffusione • Più è alto più lombra tende ad espandersi

Page 20: HTML5 e Css3 - 3 | WebMaster & WebDesigner

inset

#shadow3 {

     box­shadow: 5px 5px 10px 2px orange inset;

}

Page 21: HTML5 e Css3 - 3 | WebMaster & WebDesigner
Page 22: HTML5 e Css3 - 3 | WebMaster & WebDesigner

Domande?

Slide:

http://cypher.informazione.me/

Code:

https://github.com/inFormazione/Cypher/

mail:

[email protected]