SlideShare una empresa de Scribd logo
CSS3
        STYLING

Diego Alejandro Carrera Gallego
           dcarrera@dit.upm.es
CONTENIDO   • Introducción CSS
            • CSS 3
            • Object Oriented CSS
            • Diseño web sensible (responsive
              Design)
            • SASS
            • LESS
Para que sirve
                   PCascading Style Sheets (CSS) ?




                 + CSS =


Plantilla HTML                        HTML
Cascading Style Sheets (CSS)

Una regla CSS está formada por una parte llamada "selector" y otra
 parte llamada "declaración“

  – El selector indica "a quién hay que hacérselo".
  – La declaración indica "qué hay que hacer“


                              *{
                                margin: 0;
                                padding: 0;
                              }
Selectores …
• Selectores básicos
                              *{
                               margin: 0;
   – Selector universal        padding: 0; }

                                                       h1, h2, h3 {
   – Selector de tipo o etiqueta                        color: #8A8E27;
                                                        font-weight: normal;}

   – Selector descendiente    p span { color: red; }
                              a span{color:blue}

   – Selector de clase                                 .destacado { color: red; }
                                                       p.destacado{color:blue}

   – Selector de ID           #destacado { color: red; }
                              p#destacado{color:blue}

   – Combinación de selectores básicos                 div.aviso span.especial { ... }
                                                       ul#menuPrincipal li.destacado a#inicio { ... }
Selectores
• Selectores avanzados
   – Selector de hijo                                  <p><span>Texto1</span></p> (CUMPLE)
                                                       <p><a href="#"><span>Texto2</span></a></p> (NO CUMPLE)
     p > span{ margin: 0; padding: 0; }
   – Selector adyacente
                                                                     <body>
       H1 + h2 { color: red;}                                        <h1>Titulo1</h1> (APLICA)
      Deben cumplir dos condiciones:                                 <h2>Subtítulo</h2> (APLICA)
      elemento1 y elemento2 deben ser hermanos, por lo               <h2>Otro subtítulo</h2> (NO APLICA h1 +h2)
      que su elemento padre debe ser el mismo.                       </body>
      elemento2 debe aparecer inmediatamente después de
      elemento1 en el código HTML de la página.

   – Selector de atributos
     / * Se muestran de color azul todos los enlaces que tengan un atributo "class", independientemente de su valor */
     a[class] { color: blue; }

     /* Se muestran de color azul todos los enlaces que tengan un atributo "class" con el valor "externo" */
     a[class="externo"] { color: blue; }

     /* Se muestran de color azul todos los enlaces que apunten al sitio "http://www.ejemplo.com" */
     a[href="http://www.ejemplo.com"] { color: blue; }

     /* Se muestran de color azul todos los enlaces que tengan un atributo "class" en el que al menos uno de sus valores
       sea "externo" */
     a[class~="externo"] { color: blue; }
Módulos CSS3
Borders

                                                                     Transformaciones


                HSLA & RGBA
                                             Fondos múltiples   http://www.css3.info/
                                                                http://css3test.com/



   Selectores
                     word-wrap: break-word
CSS3
                     Módulos                                Niveles W3C
1. Efectos visuales de imágenes:
    –   Fondos y bordes                          1. Working Draft, primera
                                                    publicación disponible con las
    –   Gradientes
                                                    especificaciones
2. Transformaciones                              2. Last Call, borrador con fechas
3. Fuentes con mejores tipografías                  limites para comentarios finales
    –   Fuentes                                  3. Candidate recommendation, es
                                                    estable y puede ser
    –   Texto
                                                    implementado.
4. Selectores mejorados                          4. Proposed recommendation, un
5. Transiciones y animaciones, cambios y            documento bien revisado, para
   movimientos sin usar FLASH o Javascript.         su aprobacion final.
                                                 5. Recommendation, completo y
6. Media Queries                                    finalizado ~ standard.
7. Múltiple columnas
Prefijos


div {
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}




Herramientas que pueden ayudar:
• Sass (http://sass-lang.com ),
• LESS (http://lesscss.org ),
• eCSStender (www.alistapart.com/articles/stop-forking-withcss3 )
Bordes e imágenes …

    #mydiv{
       -webkit-border-radius:50px;
      -moz-border-radius: 50px;
    }

    #mydiv{
       -webkit-border-top-left-                 Rounded corners
      radius:50px;
      -webkit-border-bottom-left-
      radius:50px;
        -moz-border-radius-
        topleft:50px;
        -moz-border-radius-
        bottomright: 5px;
    }



http://slides.html5rocks.com/#rounded-corners
http://www.css3.info/preview/rounded-border/
http://www.w3.org/TR/css3-background/
Bordes e imágenes

    #header { -moz-border-image: url(border.png) 27 27 27 27 round round; }




http://slides.html5rocks.com/#border-image
http://css-tricks.com/understanding-border-image/
http://www.w3.org/TR/2002/WD-css3-border-20021107/#the-border-image-uri
Flexible Box Model

      • .box {
          display: -webkit-box;
          -webkit-box-orient: horizontal/vertical ;
        }
        .box .one, .box .two {
          -webkit-box-flex: 1;
        }
        .box .three {
          -webkit-box-flex: 3;
        }




http://slides.html5rocks.com/#flex-box-1
http://playground.html5rocks.com/#flex_box_model
http://developer.palm.com/blog/2011/07/css-3-flexible-box-model-and-enyo-flex-layout/
http://www.w3.org/TR/2011/WD-css3-flexbox-20110322/
Flexible Box Model

     .box {
           display: -webkit-box;
           -webkit-box-pack: start/end/center ;
           -webkit-box-align: start/end/center/strech ; }




http://slides.html5rocks.com/#flex-box-2
http://playground.html5rocks.com/#flex_box_model_-_complex
Fondos Múltiple, gradientes

      #wrapper{
         Margin:12px auto;
         width: 940px;
         height:480px;
         padding: 10px;
          -webkit-border-radius: 4px;
         -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.5);
         background: url(‘../images/screenshot.png’) 370px
                60px no-repeat,
          url(‘../images/paint.png’) top left no-repeat;
      }

      background: -webkit-gradient(radial, 430 50, 0, 430
          50, 200, from(red), to(#000))




http://slides.html5rocks.com/#css-gradients
http://www.w3.org/TR/css3-background/
Opacidad & color

  Fondos semitransparentes:                                color: rgba(255, 0, 0, 0.75);
  • RGBA (red-green-blue-alpha) or
  • HSLA (Hue / saturation / luminance / alpha)            background: rgba(0, 0, 255, 0.75);

  Hexadecimal: #A6DADC
  RGB: 166, 218, 220
  RGBA: 166, 218, 220, 1
  HSL: 182, 44%, 76%
  HSLA: 182, 44%, 76%, 1
  HSLA = (0-36, the percentage level of
  saturation, and the percentage level of
  lightness)

  color:
    hsla( 128, 75%, 33%, 1.00);


http://slides.html5rocks.com/#css-opacity
http://slides.html5rocks.com/#css-color
http://www.css3.info/preview/hsla/
http://www.w3.org/TR/css3-color/
Box transformations (2d)

    div{
     transform:rotate(30deg);
    transform: translate(80px, 80px) scale(1.5, 1.5) rotate(45deg);
    }
    .rotate-45 {
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
     }
    .rotate75 {
    -webkit-transform: rotate(75deg);
    -moz-transform: rotate(75deg);
    -o-transform: rotate(75deg);
    }
    .rotate90 {
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
     -o-transform: rotate(90deg);
     }



http://playground.html5rocks.com/#2d_transforms
http://www.w3.org/TR/css3-2d-transforms/
Webfonts

        @font-face {
                                                 header {
           font-family: 'LeagueGothic';
                                                    font-family: 'LeagueGothic';
           src: url(LeagueGothic.otf);
                                                  }
         }

          @font-face {
            font-family: 'Droid Sans';
            src: url(Droid_Sans.ttf);
          }




http://slides.html5rocks.com/#web-fonts
http://www.w3.org/TR/css3-fonts/
Text wrapping

      div {
                                                1
        text-overflow: ellipsis
      }                                         2
      …
         overflow: hidden;                      3
         text-overflow: ellipsis; (3)
         white-space: nowrap; (2,3)



      blockquote {
      …
        padding: 10px 15px 5px 15px;
        -moz-border-radius: 20px;
        -webkit-border-radius: 20px;
        border-radius: 20px;
        border-top: 1px solid #fff;
        background-color: hsl(182,44%,76%);
        word-wrap: break-word;
      }


http://slides.html5rocks.com/#text-wrapping
http://www.w3.org/TR/css3-text/
Text stroke

      • div {
        -webkit-text-fill-color: black;
         -webkit-text-stroke-color: red;
         -webkit-text-stroke-width: 2.20px;

          }




http://slides.html5rocks.com/#css-stroke
Sombras

     • text-shadow:                                     • box-shadow:
        rgba(64, 64, 64, 0.5)                              rgba(0, 0, 128, 0.25)
        5px                                                -3px
        5px                                                6px
        2px;                                               1px;




http://slides.html5rocks.com/#css-shadow
http://playground.html5rocks.com/#text_and_box_shadow
Selectores CSS3

                                                           tr:nth-of-type(even){
                                                             background-color: #F3F3F3;
                                                           }
       Bolding the Last Row with :last-child               tr:nth-of-type(odd) {
       p{ margin-bottom: 20px }                              background-color:#ddd;
       #sidebar p:last-child{                              }
         margin-bottom: 0;
       }
       td:last-child{
                                                          Negation
                                                          :not(.box){
         font-weight: bolder;
                                                            color: #00c;
       }
                                                          }
       tr:last-child td:last-child{
         font-size:24px;
       }
       Counting Backward with :nth-last-
       child
       tr:nth-last-child(2){
         color: green;
       }
       tr:nth-last-child(-n+3) td{
         text-align: right;
       }

http://www.w3.org/TR/css3-selectors/#selectors
http://dev.l-c-n.com/CSS3-selectors/browser-support.php
www.w3.org/TR/css3-selectors
http://slides.html5rocks.com/#css-selectors
Animaciones y transiciones
/* We are defining the "timeline" of the animation,
* each line representing a keyframe.
*/                                                                        •animation-delay
@-moz-keyframes bounce {                                                  •animation-direction
  /* Translate the element 400px to the right */
  /* Here we are animating "-moz-tranform",
                                                                          •animation-iteration-count
* but most CSS properties can be animated:                                •animation-name
* width, color, font-size, box-shadow, ...                                •animation-play-state
*/                                                                        •animation-timing-function
  from { -moz-transform: translate(0px); }
  60% { -moz-transform: translate(400px); }
  /* and then bounce twice */
  73% { -moz-transform: translate(360px); }
  86% { -moz-transform: translate(400px); }
  93% { -moz-transform: translate(380px); }
  to { -moz-transform: translate(400px); }
}

#anim {
  /* use the "bounce" animation */
  -moz-animation-name: bounce;
  /* animation on this element will last 1 second */
  -moz-animation-duration: 1s;
  /* the animation will loop indefinitely */             http://animatable.com/demos/madmanimation/
  -moz-animation-iteration-count: infinite;              http://www.cssplay.co.uk/menu/css3-animation.html#x
                                                         http://playground.html5rocks.com/#transitions
  /* the animation will play 3s after being applied */
                                                         http://animatable.com/demos/madmanimation/
  -moz-animation-delay: 3s;
                                                         http://hacks.mozilla.org/2011/05/advanced-animations-in-aurora-with-css3-animations/
}                                                        http://paulrouget.com/e/css3animations/
                                                         http://www.w3.org/TR/css3-animations/
Media Query

   We can use media queries to determine the following:
         –   Resolution
         –   Orientation (portrait or landscape mode)
         –   Device width and height
         –   Width and height of the browser window

 @media only screen and (max-device-width: 480px) {
 body{
   width:460px;
 }
 section#sidebar, section#posts{                        @media all and (min-width: 640px) {
   float: none;                                           #media-queries-1 { background-color: #0f0;}
   width: 100%;                                         }
 }
 }                                                      @media screen and (max-width: 2000px) {
                                                          #media-queries-2 { background-color: #0f0; }
                                                        }




http://www.w3.org/TR/css3-mediaqueries/
Multiple Columns Layout
                                                   #newsletter{
    -webkit-column-count: 2;                       -moz-column-count: 2;
                                                   -webkit-column-count: 2;
    -webkit-column-rule: 1px solid #bbb;           -moz-column-gap: 20px;
                                                   -webkit-column-gap: 20px;
    -webkit-column-gap: 2em;                       -moz-column-rule: 1px solid #ddccb5;
                                                   -webkit-column-rule: 1px solid #ddccb5;
                                                   }




http://slides.html5rocks.com/#css-columns
http://www.w3.org/TR/css3-multicol/
Evolución de los CSS




                       Responsive CSS
Object Oriented CSS

                     diseño consistente = código limpio = sitio rápido

                                                             Iniciado por: Nicole Sullivan C
 Basado en 2 principios:
 • Separar la estructura de la interface (CSS).
    Usar clases lo más posible.
 • Separar los contenedores de los
    contenidos.

   OOCSS ofrece separar las características
   más comunes en módulos u objetos que
   pueden ser reusados.
                                                                    ….evolución de los CSS
….Usar múltiples clases para simular OO.

http://github.com/stubbornella/oocss/wiki
http://www.slideshare.net/stubbornella/object-oriented-css
http://www.stubbornella.org/content/
Object Oriented CSS


1. Crear librerías                   6. Minimizar uso de selectores
2. Usar estilos con semántica        7. Separar estructura del skin
   consistente                       8. Separar contenedores y
3. Diseñar módulos que sean              contenidos
   transparente (png8)               9. Extender objetos y aplicar
4. Ser flexible                          múltiples clases a los
5. Utiliza grids (utiliza UML para       elementos
   describir HTML & CSS)             10. Usa fuentes de YUi
Que cosas no se deberían hacer en OOCSS




Redundancia




Nunca ser específico en un elemento:

           div.myClass {….}

A menos que se extienda de clases
para trabajar en varios elementos.
Diseño web sensible (responsive)




Es diseñar una web considerando el comportamiento del usuario
basado en el tamaño de pantalla, plataforma y la orientación.

Su practica consiste en el uso de mallas flexibles y layouts, imágenes y
un uso inteligente de CSS media query.
Tipos de layouts



• Fixed-width: Rigid Pixels
• Liquid or Fluid: Adapts to the
  Viewport
     – Improving readability
• Elastic: Adapts to the Text Size
     – familiar with ems
     – Zooming is not the same as resizing
       text, which is a separate browser




http://coding.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design
Imágenes flexibles

<img src="smallRes.jpg" data-fullsrc="largeRes.jpg">
img {
width: 20em;
max-width: 500px;
}
Sass makes CSS fun again (SCSS)

    Es una extensión de CSS3, añade:
    • reglas de anidamiento,
    • mezcla de variables,
    • herencia de selectores
    • y más.

    Hay dos sintaxis:
    • Archivos SCSS que usa la extensión .scss.
    • Sintaxis anterior es conocido como Sass (.sass).



http://sass-lang.com
                                                 NOTA: Sólo para RUBY
SCSS

        Variables                               Anidación




        Mezcla                              Herencia selectores




http://sass-lang.com/tutorial.html
Anidación




                                                 Referencias
                                                   padre




http://sass-lang.com/tutorial.html
Variables




                                                 Operaciones &
                                                   funciones




http://sass-lang.com/tutorial.html
Variables


                                                                       Interpolaciones




Mixins are defined using the “@mixin” directive, which takes a block      Mezclas
of styles that can then be included in another selector using the
“@include” directive.
Mezclas


          Argumentos




           @import
SASS Referencias

 $type: monster;
 p { @if $type == ocean {                           @for $i from 1 through 3 {
 color: blue; }                                       .item-#{$i} { width: 2em * $i;
 @else if $type == matador { color: red; }              }
 @else if $type == monster { color: green; }        }
 @else { color: black; }
 }                                                  $i: 6; @while $i > 0 {
                                                      .item-#{$i} { width: 2em * $i; }
  @each $animal in puma, sea-slug, egret,
                                                       $i: $i - 2;
      salamander {
                                                    }
  .#{$animal}-icon
  { background-image:
      url('/images/#{$animal}.png'); }
  }


http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html
The dynamic stylesheet language (LESS)


     • LESS extends CSS with dynamic behavior such
       as variables, mixins, operations and
       functions.

     • LESS runs on both the client-side (IE
       6+, Webkit, Firefox) and server-side, with
       Node.js and Rhino.




http://lesscss.org/
CSS3
                      STYLING
¿Preguntas?
              Diego Alejandro Carrera Gallego
                         dcarrera@dit.upm.es

Más contenido relacionado

La actualidad más candente

Tema 7 - Introducción a html con css
Tema 7 - Introducción a html con cssTema 7 - Introducción a html con css
Tema 7 - Introducción a html con css
Pamela Rodriguez
 
hojas de_estilo_css
 hojas de_estilo_css hojas de_estilo_css
hojas de_estilo_css
George Diaz
 

La actualidad más candente (20)

Introducción a HTML - CSS - JS
Introducción a HTML - CSS - JS Introducción a HTML - CSS - JS
Introducción a HTML - CSS - JS
 
Qué es CSS y con qué se come?
Qué es CSS y con qué se come?Qué es CSS y con qué se come?
Qué es CSS y con qué se come?
 
Tema 7 - Introducción a html con css
Tema 7 - Introducción a html con cssTema 7 - Introducción a html con css
Tema 7 - Introducción a html con css
 
Css power
Css powerCss power
Css power
 
Estilo & CSS3
Estilo & CSS3Estilo & CSS3
Estilo & CSS3
 
Semana 3 Introduccion CSS
Semana 3   Introduccion CSSSemana 3   Introduccion CSS
Semana 3 Introduccion CSS
 
Sesion01
Sesion01Sesion01
Sesion01
 
hojas de_estilo_css
 hojas de_estilo_css hojas de_estilo_css
hojas de_estilo_css
 
Taller de Maquetación Web
Taller de Maquetación WebTaller de Maquetación Web
Taller de Maquetación Web
 
Hojas de estilo en cascada
Hojas de estilo en cascadaHojas de estilo en cascada
Hojas de estilo en cascada
 
3.css
3.css3.css
3.css
 
Css posicionamiento de pag web presentacion de la semana
Css posicionamiento de pag web      presentacion de la semanaCss posicionamiento de pag web      presentacion de la semana
Css posicionamiento de pag web presentacion de la semana
 
Qué es css
Qué es cssQué es css
Qué es css
 
Intro a Sass
Intro a Sass Intro a Sass
Intro a Sass
 
Css Introducción
Css IntroducciónCss Introducción
Css Introducción
 
02. Interactuando con controles de UI
02. Interactuando con controles de UI02. Interactuando con controles de UI
02. Interactuando con controles de UI
 
1. Introducción a las Hojas de estilo (CSS)
1. Introducción a las Hojas de estilo (CSS)1. Introducción a las Hojas de estilo (CSS)
1. Introducción a las Hojas de estilo (CSS)
 
HTML5+CSS3 01
HTML5+CSS3 01HTML5+CSS3 01
HTML5+CSS3 01
 
Manual css3 nov2014
Manual css3 nov2014Manual css3 nov2014
Manual css3 nov2014
 
Introducción a SASS - Diseño de Interfaces Web (Desarrollo de Aplicaciones Web)
Introducción a SASS - Diseño de Interfaces Web (Desarrollo de Aplicaciones Web)Introducción a SASS - Diseño de Interfaces Web (Desarrollo de Aplicaciones Web)
Introducción a SASS - Diseño de Interfaces Web (Desarrollo de Aplicaciones Web)
 

Destacado

Destacado (9)

Css3
Css3Css3
Css3
 
CSS3: A practical introduction (FT2010 talk)
CSS3: A practical introduction (FT2010 talk)CSS3: A practical introduction (FT2010 talk)
CSS3: A practical introduction (FT2010 talk)
 
Css3 Presetation
Css3 PresetationCss3 Presetation
Css3 Presetation
 
New HTML5/CSS3 techniques
New HTML5/CSS3 techniquesNew HTML5/CSS3 techniques
New HTML5/CSS3 techniques
 
CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3
 
Tutorial: Html5 And Css3 Site
Tutorial: Html5 And Css3 SiteTutorial: Html5 And Css3 Site
Tutorial: Html5 And Css3 Site
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
 
Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3
 
How to use CSS3 in WordPress
How to use CSS3 in WordPressHow to use CSS3 in WordPress
How to use CSS3 in WordPress
 

Similar a CSS3

Frameworks CSS
Frameworks CSSFrameworks CSS
Frameworks CSS
betabeers
 

Similar a CSS3 (20)

Semana 3 Maquetación CSS
Semana 3   Maquetación CSSSemana 3   Maquetación CSS
Semana 3 Maquetación CSS
 
Frameworks CSS
Frameworks CSSFrameworks CSS
Frameworks CSS
 
Introducción a los Frameworks CSS
Introducción a los Frameworks CSSIntroducción a los Frameworks CSS
Introducción a los Frameworks CSS
 
T2 1-css
T2 1-cssT2 1-css
T2 1-css
 
Variables nativas CSS, Front-End con superpoderes para tu WordPress
Variables nativas CSS, Front-End con superpoderes para tu WordPressVariables nativas CSS, Front-End con superpoderes para tu WordPress
Variables nativas CSS, Front-End con superpoderes para tu WordPress
 
Css: bases y buenas prácticas
Css: bases y buenas prácticasCss: bases y buenas prácticas
Css: bases y buenas prácticas
 
Clase1
Clase1Clase1
Clase1
 
Laboratorio 03
Laboratorio 03Laboratorio 03
Laboratorio 03
 
Identificación del lenguaje ccs
Identificación del lenguaje ccsIdentificación del lenguaje ccs
Identificación del lenguaje ccs
 
Hojas de Estilo en Cascada - CSS
Hojas de Estilo en Cascada - CSSHojas de Estilo en Cascada - CSS
Hojas de Estilo en Cascada - CSS
 
Introducción CSS
Introducción CSSIntroducción CSS
Introducción CSS
 
Presentación CSS y HTML en Gummurcia
Presentación CSS y HTML en GummurciaPresentación CSS y HTML en Gummurcia
Presentación CSS y HTML en Gummurcia
 
Programacion web
Programacion webProgramacion web
Programacion web
 
Sngular - Sass: Vitamina tu CSS
Sngular - Sass: Vitamina tu CSSSngular - Sass: Vitamina tu CSS
Sngular - Sass: Vitamina tu CSS
 
Etilos
Etilos Etilos
Etilos
 
Desarrollo web inteligente
Desarrollo web inteligenteDesarrollo web inteligente
Desarrollo web inteligente
 
Conferencia HTML5 y CSS3 por Alexandra García Milan
Conferencia HTML5 y CSS3 por Alexandra García MilanConferencia HTML5 y CSS3 por Alexandra García Milan
Conferencia HTML5 y CSS3 por Alexandra García Milan
 
CSS, planeando para el futuro
CSS, planeando para el futuroCSS, planeando para el futuro
CSS, planeando para el futuro
 
Css3
Css3Css3
Css3
 
Ria 03-html5-css3
Ria 03-html5-css3Ria 03-html5-css3
Ria 03-html5-css3
 

Último

Un libro sin recetas, para la maestra y el maestro Fase 3.pdf
Un libro sin recetas, para la maestra y el maestro Fase 3.pdfUn libro sin recetas, para la maestra y el maestro Fase 3.pdf
Un libro sin recetas, para la maestra y el maestro Fase 3.pdf
sandradianelly
 
PRÁCTICAS PEDAGOGÍA.pdf_Educación Y Sociedad_AnaFernández
PRÁCTICAS PEDAGOGÍA.pdf_Educación Y Sociedad_AnaFernándezPRÁCTICAS PEDAGOGÍA.pdf_Educación Y Sociedad_AnaFernández
PRÁCTICAS PEDAGOGÍA.pdf_Educación Y Sociedad_AnaFernández
Ruben53283
 
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdfFORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
El Fortí
 
diagnostico final (1). analisis - encuestas
diagnostico final (1). analisis - encuestasdiagnostico final (1). analisis - encuestas
diagnostico final (1). analisis - encuestas
ansomora123
 
Asistencia Tecnica Cultura Escolar Inclusiva Ccesa007.pdf
Asistencia Tecnica Cultura Escolar Inclusiva Ccesa007.pdfAsistencia Tecnica Cultura Escolar Inclusiva Ccesa007.pdf
Asistencia Tecnica Cultura Escolar Inclusiva Ccesa007.pdf
Demetrio Ccesa Rayme
 

Último (20)

PRESENTACION DE LA SEMANA NUMERO 8 EN APLICACIONES DE INTERNET
PRESENTACION DE LA SEMANA NUMERO 8 EN APLICACIONES DE INTERNETPRESENTACION DE LA SEMANA NUMERO 8 EN APLICACIONES DE INTERNET
PRESENTACION DE LA SEMANA NUMERO 8 EN APLICACIONES DE INTERNET
 
Un libro sin recetas, para la maestra y el maestro Fase 3.pdf
Un libro sin recetas, para la maestra y el maestro Fase 3.pdfUn libro sin recetas, para la maestra y el maestro Fase 3.pdf
Un libro sin recetas, para la maestra y el maestro Fase 3.pdf
 
PROYECTO INTEGRADOR ARCHIDUQUE. presentacion
PROYECTO INTEGRADOR ARCHIDUQUE. presentacionPROYECTO INTEGRADOR ARCHIDUQUE. presentacion
PROYECTO INTEGRADOR ARCHIDUQUE. presentacion
 
Lección 1: Los complementos del Verbo ...
Lección 1: Los complementos del Verbo ...Lección 1: Los complementos del Verbo ...
Lección 1: Los complementos del Verbo ...
 
Proyecto Integrador 2024. Archiduque entrevistas
Proyecto Integrador 2024. Archiduque entrevistasProyecto Integrador 2024. Archiduque entrevistas
Proyecto Integrador 2024. Archiduque entrevistas
 
PRÁCTICAS PEDAGOGÍA.pdf_Educación Y Sociedad_AnaFernández
PRÁCTICAS PEDAGOGÍA.pdf_Educación Y Sociedad_AnaFernándezPRÁCTICAS PEDAGOGÍA.pdf_Educación Y Sociedad_AnaFernández
PRÁCTICAS PEDAGOGÍA.pdf_Educación Y Sociedad_AnaFernández
 
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdfFORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
FORTI-JUNIO 2024. CIENCIA, EDUCACION, CULTURA,pdf
 
Semana 10-TSM-del 27 al 31 de mayo 2024.pptx
Semana 10-TSM-del 27 al 31 de mayo 2024.pptxSemana 10-TSM-del 27 al 31 de mayo 2024.pptx
Semana 10-TSM-del 27 al 31 de mayo 2024.pptx
 
Conocemos la ermita de Ntra. Sra. del Arrabal
Conocemos la ermita de Ntra. Sra. del ArrabalConocemos la ermita de Ntra. Sra. del Arrabal
Conocemos la ermita de Ntra. Sra. del Arrabal
 
Creación WEB. Ideas clave para crear un sitio web
Creación WEB. Ideas clave para crear un sitio webCreación WEB. Ideas clave para crear un sitio web
Creación WEB. Ideas clave para crear un sitio web
 
2º conclusiones descriptivas educacion fisica (1).docx
2º conclusiones descriptivas educacion fisica (1).docx2º conclusiones descriptivas educacion fisica (1).docx
2º conclusiones descriptivas educacion fisica (1).docx
 
Introducción a la ciencia de datos con power BI
Introducción a la ciencia de datos con power BIIntroducción a la ciencia de datos con power BI
Introducción a la ciencia de datos con power BI
 
Portafolio de servicios Centro de Educación Continua EPN
Portafolio de servicios Centro de Educación Continua EPNPortafolio de servicios Centro de Educación Continua EPN
Portafolio de servicios Centro de Educación Continua EPN
 
diagnostico final (1). analisis - encuestas
diagnostico final (1). analisis - encuestasdiagnostico final (1). analisis - encuestas
diagnostico final (1). analisis - encuestas
 
Fase 2, Pensamiento variacional y trigonometrico
Fase 2, Pensamiento variacional y trigonometricoFase 2, Pensamiento variacional y trigonometrico
Fase 2, Pensamiento variacional y trigonometrico
 
CONCLUSIONES-DESCRIPTIVAS NIVEL PRIMARIA
CONCLUSIONES-DESCRIPTIVAS NIVEL PRIMARIACONCLUSIONES-DESCRIPTIVAS NIVEL PRIMARIA
CONCLUSIONES-DESCRIPTIVAS NIVEL PRIMARIA
 
Asistencia Tecnica Cultura Escolar Inclusiva Ccesa007.pdf
Asistencia Tecnica Cultura Escolar Inclusiva Ccesa007.pdfAsistencia Tecnica Cultura Escolar Inclusiva Ccesa007.pdf
Asistencia Tecnica Cultura Escolar Inclusiva Ccesa007.pdf
 
IMÁGENES SUBLIMINALES EN LAS PUBLICACIONES DE LOS TESTIGOS DE JEHOVÁ
IMÁGENES SUBLIMINALES EN LAS PUBLICACIONES DE LOS TESTIGOS DE JEHOVÁIMÁGENES SUBLIMINALES EN LAS PUBLICACIONES DE LOS TESTIGOS DE JEHOVÁ
IMÁGENES SUBLIMINALES EN LAS PUBLICACIONES DE LOS TESTIGOS DE JEHOVÁ
 
UNIDAD DE APRENDIZAJE DEL MES Junio 2024
UNIDAD DE APRENDIZAJE DEL MES  Junio 2024UNIDAD DE APRENDIZAJE DEL MES  Junio 2024
UNIDAD DE APRENDIZAJE DEL MES Junio 2024
 
La Hegemonía Liberal en Paraguay 1904 a 1936.ppt
La Hegemonía Liberal en Paraguay 1904 a 1936.pptLa Hegemonía Liberal en Paraguay 1904 a 1936.ppt
La Hegemonía Liberal en Paraguay 1904 a 1936.ppt
 

CSS3

  • 1. CSS3 STYLING Diego Alejandro Carrera Gallego dcarrera@dit.upm.es
  • 2. CONTENIDO • Introducción CSS • CSS 3 • Object Oriented CSS • Diseño web sensible (responsive Design) • SASS • LESS
  • 3. Para que sirve PCascading Style Sheets (CSS) ? + CSS = Plantilla HTML HTML
  • 4. Cascading Style Sheets (CSS) Una regla CSS está formada por una parte llamada "selector" y otra parte llamada "declaración“ – El selector indica "a quién hay que hacérselo". – La declaración indica "qué hay que hacer“ *{ margin: 0; padding: 0; }
  • 5. Selectores … • Selectores básicos *{ margin: 0; – Selector universal padding: 0; } h1, h2, h3 { – Selector de tipo o etiqueta color: #8A8E27; font-weight: normal;} – Selector descendiente p span { color: red; } a span{color:blue} – Selector de clase .destacado { color: red; } p.destacado{color:blue} – Selector de ID #destacado { color: red; } p#destacado{color:blue} – Combinación de selectores básicos div.aviso span.especial { ... } ul#menuPrincipal li.destacado a#inicio { ... }
  • 6. Selectores • Selectores avanzados – Selector de hijo <p><span>Texto1</span></p> (CUMPLE) <p><a href="#"><span>Texto2</span></a></p> (NO CUMPLE) p > span{ margin: 0; padding: 0; } – Selector adyacente <body> H1 + h2 { color: red;} <h1>Titulo1</h1> (APLICA) Deben cumplir dos condiciones: <h2>Subtítulo</h2> (APLICA) elemento1 y elemento2 deben ser hermanos, por lo <h2>Otro subtítulo</h2> (NO APLICA h1 +h2) que su elemento padre debe ser el mismo. </body> elemento2 debe aparecer inmediatamente después de elemento1 en el código HTML de la página. – Selector de atributos / * Se muestran de color azul todos los enlaces que tengan un atributo "class", independientemente de su valor */ a[class] { color: blue; } /* Se muestran de color azul todos los enlaces que tengan un atributo "class" con el valor "externo" */ a[class="externo"] { color: blue; } /* Se muestran de color azul todos los enlaces que apunten al sitio "http://www.ejemplo.com" */ a[href="http://www.ejemplo.com"] { color: blue; } /* Se muestran de color azul todos los enlaces que tengan un atributo "class" en el que al menos uno de sus valores sea "externo" */ a[class~="externo"] { color: blue; }
  • 7. Módulos CSS3 Borders Transformaciones HSLA & RGBA Fondos múltiples http://www.css3.info/ http://css3test.com/ Selectores word-wrap: break-word
  • 8. CSS3 Módulos Niveles W3C 1. Efectos visuales de imágenes: – Fondos y bordes 1. Working Draft, primera publicación disponible con las – Gradientes especificaciones 2. Transformaciones 2. Last Call, borrador con fechas 3. Fuentes con mejores tipografías limites para comentarios finales – Fuentes 3. Candidate recommendation, es estable y puede ser – Texto implementado. 4. Selectores mejorados 4. Proposed recommendation, un 5. Transiciones y animaciones, cambios y documento bien revisado, para movimientos sin usar FLASH o Javascript. su aprobacion final. 5. Recommendation, completo y 6. Media Queries finalizado ~ standard. 7. Múltiple columnas
  • 9. Prefijos div { -moz-transform: rotate(45deg); -o-transform: rotate(45deg); -webkit-transform: rotate(45deg); transform: rotate(45deg); } Herramientas que pueden ayudar: • Sass (http://sass-lang.com ), • LESS (http://lesscss.org ), • eCSStender (www.alistapart.com/articles/stop-forking-withcss3 )
  • 10. Bordes e imágenes … #mydiv{ -webkit-border-radius:50px; -moz-border-radius: 50px; } #mydiv{ -webkit-border-top-left- Rounded corners radius:50px; -webkit-border-bottom-left- radius:50px; -moz-border-radius- topleft:50px; -moz-border-radius- bottomright: 5px; } http://slides.html5rocks.com/#rounded-corners http://www.css3.info/preview/rounded-border/ http://www.w3.org/TR/css3-background/
  • 11. Bordes e imágenes #header { -moz-border-image: url(border.png) 27 27 27 27 round round; } http://slides.html5rocks.com/#border-image http://css-tricks.com/understanding-border-image/ http://www.w3.org/TR/2002/WD-css3-border-20021107/#the-border-image-uri
  • 12. Flexible Box Model • .box { display: -webkit-box; -webkit-box-orient: horizontal/vertical ; } .box .one, .box .two { -webkit-box-flex: 1; } .box .three { -webkit-box-flex: 3; } http://slides.html5rocks.com/#flex-box-1 http://playground.html5rocks.com/#flex_box_model http://developer.palm.com/blog/2011/07/css-3-flexible-box-model-and-enyo-flex-layout/ http://www.w3.org/TR/2011/WD-css3-flexbox-20110322/
  • 13. Flexible Box Model .box { display: -webkit-box; -webkit-box-pack: start/end/center ; -webkit-box-align: start/end/center/strech ; } http://slides.html5rocks.com/#flex-box-2 http://playground.html5rocks.com/#flex_box_model_-_complex
  • 14. Fondos Múltiple, gradientes #wrapper{ Margin:12px auto; width: 940px; height:480px; padding: 10px; -webkit-border-radius: 4px; -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.5); background: url(‘../images/screenshot.png’) 370px 60px no-repeat, url(‘../images/paint.png’) top left no-repeat; } background: -webkit-gradient(radial, 430 50, 0, 430 50, 200, from(red), to(#000)) http://slides.html5rocks.com/#css-gradients http://www.w3.org/TR/css3-background/
  • 15. Opacidad & color Fondos semitransparentes: color: rgba(255, 0, 0, 0.75); • RGBA (red-green-blue-alpha) or • HSLA (Hue / saturation / luminance / alpha) background: rgba(0, 0, 255, 0.75); Hexadecimal: #A6DADC RGB: 166, 218, 220 RGBA: 166, 218, 220, 1 HSL: 182, 44%, 76% HSLA: 182, 44%, 76%, 1 HSLA = (0-36, the percentage level of saturation, and the percentage level of lightness) color: hsla( 128, 75%, 33%, 1.00); http://slides.html5rocks.com/#css-opacity http://slides.html5rocks.com/#css-color http://www.css3.info/preview/hsla/ http://www.w3.org/TR/css3-color/
  • 16. Box transformations (2d) div{ transform:rotate(30deg); transform: translate(80px, 80px) scale(1.5, 1.5) rotate(45deg); } .rotate-45 { -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -o-transform: rotate(-45deg); } .rotate75 { -webkit-transform: rotate(75deg); -moz-transform: rotate(75deg); -o-transform: rotate(75deg); } .rotate90 { -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -o-transform: rotate(90deg); } http://playground.html5rocks.com/#2d_transforms http://www.w3.org/TR/css3-2d-transforms/
  • 17. Webfonts @font-face { header { font-family: 'LeagueGothic'; font-family: 'LeagueGothic'; src: url(LeagueGothic.otf); } } @font-face { font-family: 'Droid Sans'; src: url(Droid_Sans.ttf); } http://slides.html5rocks.com/#web-fonts http://www.w3.org/TR/css3-fonts/
  • 18. Text wrapping div { 1 text-overflow: ellipsis } 2 … overflow: hidden; 3 text-overflow: ellipsis; (3) white-space: nowrap; (2,3) blockquote { … padding: 10px 15px 5px 15px; -moz-border-radius: 20px; -webkit-border-radius: 20px; border-radius: 20px; border-top: 1px solid #fff; background-color: hsl(182,44%,76%); word-wrap: break-word; } http://slides.html5rocks.com/#text-wrapping http://www.w3.org/TR/css3-text/
  • 19. Text stroke • div { -webkit-text-fill-color: black; -webkit-text-stroke-color: red; -webkit-text-stroke-width: 2.20px; } http://slides.html5rocks.com/#css-stroke
  • 20. Sombras • text-shadow: • box-shadow: rgba(64, 64, 64, 0.5) rgba(0, 0, 128, 0.25) 5px -3px 5px 6px 2px; 1px; http://slides.html5rocks.com/#css-shadow http://playground.html5rocks.com/#text_and_box_shadow
  • 21. Selectores CSS3 tr:nth-of-type(even){ background-color: #F3F3F3; } Bolding the Last Row with :last-child tr:nth-of-type(odd) { p{ margin-bottom: 20px } background-color:#ddd; #sidebar p:last-child{ } margin-bottom: 0; } td:last-child{ Negation :not(.box){ font-weight: bolder; color: #00c; } } tr:last-child td:last-child{ font-size:24px; } Counting Backward with :nth-last- child tr:nth-last-child(2){ color: green; } tr:nth-last-child(-n+3) td{ text-align: right; } http://www.w3.org/TR/css3-selectors/#selectors http://dev.l-c-n.com/CSS3-selectors/browser-support.php www.w3.org/TR/css3-selectors http://slides.html5rocks.com/#css-selectors
  • 22. Animaciones y transiciones /* We are defining the "timeline" of the animation, * each line representing a keyframe. */ •animation-delay @-moz-keyframes bounce { •animation-direction /* Translate the element 400px to the right */ /* Here we are animating "-moz-tranform", •animation-iteration-count * but most CSS properties can be animated: •animation-name * width, color, font-size, box-shadow, ... •animation-play-state */ •animation-timing-function from { -moz-transform: translate(0px); } 60% { -moz-transform: translate(400px); } /* and then bounce twice */ 73% { -moz-transform: translate(360px); } 86% { -moz-transform: translate(400px); } 93% { -moz-transform: translate(380px); } to { -moz-transform: translate(400px); } } #anim { /* use the "bounce" animation */ -moz-animation-name: bounce; /* animation on this element will last 1 second */ -moz-animation-duration: 1s; /* the animation will loop indefinitely */ http://animatable.com/demos/madmanimation/ -moz-animation-iteration-count: infinite; http://www.cssplay.co.uk/menu/css3-animation.html#x http://playground.html5rocks.com/#transitions /* the animation will play 3s after being applied */ http://animatable.com/demos/madmanimation/ -moz-animation-delay: 3s; http://hacks.mozilla.org/2011/05/advanced-animations-in-aurora-with-css3-animations/ } http://paulrouget.com/e/css3animations/ http://www.w3.org/TR/css3-animations/
  • 23. Media Query We can use media queries to determine the following: – Resolution – Orientation (portrait or landscape mode) – Device width and height – Width and height of the browser window @media only screen and (max-device-width: 480px) { body{ width:460px; } section#sidebar, section#posts{ @media all and (min-width: 640px) { float: none; #media-queries-1 { background-color: #0f0;} width: 100%; } } } @media screen and (max-width: 2000px) { #media-queries-2 { background-color: #0f0; } } http://www.w3.org/TR/css3-mediaqueries/
  • 24. Multiple Columns Layout #newsletter{ -webkit-column-count: 2; -moz-column-count: 2; -webkit-column-count: 2; -webkit-column-rule: 1px solid #bbb; -moz-column-gap: 20px; -webkit-column-gap: 20px; -webkit-column-gap: 2em; -moz-column-rule: 1px solid #ddccb5; -webkit-column-rule: 1px solid #ddccb5; } http://slides.html5rocks.com/#css-columns http://www.w3.org/TR/css3-multicol/
  • 25. Evolución de los CSS Responsive CSS
  • 26. Object Oriented CSS diseño consistente = código limpio = sitio rápido Iniciado por: Nicole Sullivan C Basado en 2 principios: • Separar la estructura de la interface (CSS). Usar clases lo más posible. • Separar los contenedores de los contenidos. OOCSS ofrece separar las características más comunes en módulos u objetos que pueden ser reusados. ….evolución de los CSS ….Usar múltiples clases para simular OO. http://github.com/stubbornella/oocss/wiki http://www.slideshare.net/stubbornella/object-oriented-css http://www.stubbornella.org/content/
  • 27. Object Oriented CSS 1. Crear librerías 6. Minimizar uso de selectores 2. Usar estilos con semántica 7. Separar estructura del skin consistente 8. Separar contenedores y 3. Diseñar módulos que sean contenidos transparente (png8) 9. Extender objetos y aplicar 4. Ser flexible múltiples clases a los 5. Utiliza grids (utiliza UML para elementos describir HTML & CSS) 10. Usa fuentes de YUi
  • 28. Que cosas no se deberían hacer en OOCSS Redundancia Nunca ser específico en un elemento: div.myClass {….} A menos que se extienda de clases para trabajar en varios elementos.
  • 29. Diseño web sensible (responsive) Es diseñar una web considerando el comportamiento del usuario basado en el tamaño de pantalla, plataforma y la orientación. Su practica consiste en el uso de mallas flexibles y layouts, imágenes y un uso inteligente de CSS media query.
  • 30. Tipos de layouts • Fixed-width: Rigid Pixels • Liquid or Fluid: Adapts to the Viewport – Improving readability • Elastic: Adapts to the Text Size – familiar with ems – Zooming is not the same as resizing text, which is a separate browser http://coding.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design
  • 31. Imágenes flexibles <img src="smallRes.jpg" data-fullsrc="largeRes.jpg"> img { width: 20em; max-width: 500px; }
  • 32. Sass makes CSS fun again (SCSS) Es una extensión de CSS3, añade: • reglas de anidamiento, • mezcla de variables, • herencia de selectores • y más. Hay dos sintaxis: • Archivos SCSS que usa la extensión .scss. • Sintaxis anterior es conocido como Sass (.sass). http://sass-lang.com NOTA: Sólo para RUBY
  • 33. SCSS Variables Anidación Mezcla Herencia selectores http://sass-lang.com/tutorial.html
  • 34. Anidación Referencias padre http://sass-lang.com/tutorial.html
  • 35. Variables Operaciones & funciones http://sass-lang.com/tutorial.html
  • 36. Variables Interpolaciones Mixins are defined using the “@mixin” directive, which takes a block Mezclas of styles that can then be included in another selector using the “@include” directive.
  • 37. Mezclas Argumentos @import
  • 38. SASS Referencias $type: monster; p { @if $type == ocean { @for $i from 1 through 3 { color: blue; } .item-#{$i} { width: 2em * $i; @else if $type == matador { color: red; } } @else if $type == monster { color: green; } } @else { color: black; } } $i: 6; @while $i > 0 { .item-#{$i} { width: 2em * $i; } @each $animal in puma, sea-slug, egret, $i: $i - 2; salamander { } .#{$animal}-icon { background-image: url('/images/#{$animal}.png'); } } http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html
  • 39. The dynamic stylesheet language (LESS) • LESS extends CSS with dynamic behavior such as variables, mixins, operations and functions. • LESS runs on both the client-side (IE 6+, Webkit, Firefox) and server-side, with Node.js and Rhino. http://lesscss.org/
  • 40. CSS3 STYLING ¿Preguntas? Diego Alejandro Carrera Gallego dcarrera@dit.upm.es