SlideShare uma empresa Scribd logo
1 de 26
CSS + Templates
    sapo blogs / lab mm4
Pedro Correia
   web developer at sapo blogs


pedro.c.correia@telecom.pt

         @opedrocorreia
CSS ?
Cascading Style Sheets
porquê CSS?

•   separação do conteúdo / estrutura da apresentação

•   output para múltiplos formatos

•   melhor performance

•   melhor manutenção

•   acessibilidade


• web standards
como incluo?

•   inline       <a style=”padding:20px;”>




• embed          na tag HEAD: declarar a secção <style></style>




• referência *   ficheiro externo .css, referenciado na tag HEAD




                                                   * recomendado
anatomia e uso
  selector        declaração


                 propriedade   valor
tag          {
                 font-size: 40px;
                 height: 100px;
                 width: 200px;
             }                         #id { }

                                       #id .parent { }
.class       {
                 font-size: 40px;      #id .parent div.child { }
                 height: 100px;
                 width: 200px;
                                       #id .parent div.child ul > li { }
             }
                                       #id .parent div.child ul > li span { }
#id          {
                 font-size: 40px;
                 height: 100px;
                 width: 200px;
             }
agrupamento e ordem
      h1 { font-size: 20px; }             h1 { width: 200px; }

        h1 { width: 20px; }                h1 { width: 20px; }


                =                                 =
h1 { font-size: 20px; width: 20px; }      h1 { width: 20px; }



                                         se a mesma propriedade é
    as propriedades podem ser
                                       declarada, fica em vigor a que é
            agrupadas
                                             declarada em último
agrupamento e ordem
        div { font-size: 20px; }

        h1 { font-size: 20px; }


                  =
      h1, div { font-size: 20px; }




     os selectores podem também
             ser agrupados
especificidade
                                       #test-id   { font-size: 10px; }
<a class=”test-class” id=”test-id”>
                                      .test-class { font-size: 12px; }         WINNER!
                                      a           { font-size: 20px; }


           victory
          is mine!




                             >                              >


           #id                        .class                             tag
box-model
margin

                            border

                  padding

         width



                 content
block e inline
            existem dois tipos de elementos HTML, block e inline


        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac metus id libero rhoncus congue a
        non dolor. Etiam a nibh quis mauris porta tempor vel vitae erat. Nulla in lacus augue. Nam id ligula
        lacus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In a
        justo mauris, sed sollicitudin diam.

        Morbi dapibus varius turpis, semper lacinia massa molestie et. Mauris varius consectetur vehicula.
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vitae est quam, non lacinia mauris. Sed
        nec turpis turpis. Nullam vehicula consectetur justo vel vestibulum. Ut sit amet sapien sed quam
        feugiat porta eget sed lorem.




elemento block (<div> ou <p>)                :::    nova linha

elemento inline (<span> ou <em>)             :::    onde quer seja colocado e não cria uma nova linha

> com CSS pode-se converter um elemento inline em block e vice-versa.


                                     display: inline; ou display: block;
float
                              float:left e float:right

desenrolar normal do render                                caixa 2 com float:right;



 caixa 1                                         caixa 1               caixa 2



 caixa 2                                         caixa 3



 caixa 3
float
                                        float:left e float:right

desenrolar normal do render                                                  caixa 1 com float:left;
                                                                            Lorem ipsum dolor sit amet,
                                                                            consectetur adipiscing elit.
                                                                            Donec vitae facilisis metus.
 caixa 1                                                    caixa 1         Quisque vitae odio neque, at
                                                                            placerat tortor. Phasellus sit
                                                                            amet ullamcorper ligula.
Lorem ipsum dolor sit amet, consectetur                    Nulla ultricies consequat pharetra. Proin
adipiscing elit. Donec vitae facilisis metus.              scelerisque lorem eget ligula lacinia cursus.
Quisque vitae odio neque, at placerat tortor.              Donec consectetur, elit ac bibendum
Phasellus sit amet ullamcorper ligula. Nulla               ultricies, magna lorem ultricies sem, sit
ultricies consequat pharetra. Proin                        amet mollis est sapien ut dui. Vivamus
scelerisque lorem eget ligula lacinia cursus.              vulputate rutrum purus at luctus. Mauris
Donec consectetur, elit ac bibendum                        tortor odio, luctus sit amet rutrum in,
ultricies, magna lorem ultricies sem, sit                  dapibus rhoncus nisi.
amet mollis est sapien ut dui. Vivamus
vulputate rutrum purus at luctus. Mauris
tortor odio, luctus sit amet rutrum in,
dapibus rhoncus nisi.
float
                      propriedade clear (left, right, both)
vários elementos com float: left;




com clear




 clear: both;




 clear: both;
position
                                position: relative;

body


             id = “elemento1”



                                                      #elemento3 {
                                                                     position: relative;
                                                                     top: 30px;
                                                                     left: 30px;
       id = “elemento3”                                          }



             id = “elemento2”
position
                                   position: absolute;

body


                id = “elemento1”
       id = “elemento3”

                                                         #elemento3 {
                                                                        position: absolute;
                                                                        top: 30px;
                                                                        left: 30px;
                                                                    }



                id = “elemento2”
position
                  position: absolute; e position: relative;

body


              id = “elemento1”
                                                #elemento2 {
                                                                  position: relative;
                                                              }


       id = “elemento3”                         #elemento3 {
                                                                  position: absolute;
                                                                  top: 30px;
                                                                  left: 30px;
                                                              }
              id = “elemento2”
position

                  not on my
                   watch!
position: fixed;

                              internet explorer 6
enough about CSS
Blogs do SAPO
tipos de páginas
•   página de entrada

•   arquivo
      •       ano

      •       mês

      •       dia


•   página do post
      •       comentários ao post


•   página para comentar

•   página dos resultados da pesquisa

•   página com todas as tags
composição de um post

•   título

•   data

•   conteúdo

•   metadata (tags, mood, música)

•   assinatura
       •     autor

       •     links (do post, comentar, comentários)


•   widgets (sharethis)
componentes (sidebar)

•   título

•   conteúdo
ferramentas

• firefox   (duh..)

  plugins:
    •   firebug

    •   web developer toolbar

    •   colorzilla

    •   measureit
compatibilidade

• Internet Explorer 6, 7, 8
• Firefox 3.*
• Safari 4.*
• Chrome 4.*
muitos, muitos testes

Mais conteúdo relacionado

Destaque

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destaque (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

CSS Templates

  • 1. CSS + Templates sapo blogs / lab mm4
  • 2. Pedro Correia web developer at sapo blogs pedro.c.correia@telecom.pt @opedrocorreia
  • 4. porquê CSS? • separação do conteúdo / estrutura da apresentação • output para múltiplos formatos • melhor performance • melhor manutenção • acessibilidade • web standards
  • 5. como incluo? • inline <a style=”padding:20px;”> • embed na tag HEAD: declarar a secção <style></style> • referência * ficheiro externo .css, referenciado na tag HEAD * recomendado
  • 6. anatomia e uso selector declaração propriedade valor tag { font-size: 40px; height: 100px; width: 200px; } #id { } #id .parent { } .class { font-size: 40px; #id .parent div.child { } height: 100px; width: 200px; #id .parent div.child ul > li { } } #id .parent div.child ul > li span { } #id { font-size: 40px; height: 100px; width: 200px; }
  • 7. agrupamento e ordem h1 { font-size: 20px; } h1 { width: 200px; } h1 { width: 20px; } h1 { width: 20px; } = = h1 { font-size: 20px; width: 20px; } h1 { width: 20px; } se a mesma propriedade é as propriedades podem ser declarada, fica em vigor a que é agrupadas declarada em último
  • 8. agrupamento e ordem div { font-size: 20px; } h1 { font-size: 20px; } = h1, div { font-size: 20px; } os selectores podem também ser agrupados
  • 9. especificidade #test-id { font-size: 10px; } <a class=”test-class” id=”test-id”> .test-class { font-size: 12px; } WINNER! a { font-size: 20px; } victory is mine! > > #id .class tag
  • 10. box-model margin border padding width content
  • 11. block e inline existem dois tipos de elementos HTML, block e inline Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac metus id libero rhoncus congue a non dolor. Etiam a nibh quis mauris porta tempor vel vitae erat. Nulla in lacus augue. Nam id ligula lacus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In a justo mauris, sed sollicitudin diam. Morbi dapibus varius turpis, semper lacinia massa molestie et. Mauris varius consectetur vehicula. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vitae est quam, non lacinia mauris. Sed nec turpis turpis. Nullam vehicula consectetur justo vel vestibulum. Ut sit amet sapien sed quam feugiat porta eget sed lorem. elemento block (<div> ou <p>) ::: nova linha elemento inline (<span> ou <em>) ::: onde quer seja colocado e não cria uma nova linha > com CSS pode-se converter um elemento inline em block e vice-versa. display: inline; ou display: block;
  • 12. float float:left e float:right desenrolar normal do render caixa 2 com float:right; caixa 1 caixa 1 caixa 2 caixa 2 caixa 3 caixa 3
  • 13. float float:left e float:right desenrolar normal do render caixa 1 com float:left; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vitae facilisis metus. caixa 1 caixa 1 Quisque vitae odio neque, at placerat tortor. Phasellus sit amet ullamcorper ligula. Lorem ipsum dolor sit amet, consectetur Nulla ultricies consequat pharetra. Proin adipiscing elit. Donec vitae facilisis metus. scelerisque lorem eget ligula lacinia cursus. Quisque vitae odio neque, at placerat tortor. Donec consectetur, elit ac bibendum Phasellus sit amet ullamcorper ligula. Nulla ultricies, magna lorem ultricies sem, sit ultricies consequat pharetra. Proin amet mollis est sapien ut dui. Vivamus scelerisque lorem eget ligula lacinia cursus. vulputate rutrum purus at luctus. Mauris Donec consectetur, elit ac bibendum tortor odio, luctus sit amet rutrum in, ultricies, magna lorem ultricies sem, sit dapibus rhoncus nisi. amet mollis est sapien ut dui. Vivamus vulputate rutrum purus at luctus. Mauris tortor odio, luctus sit amet rutrum in, dapibus rhoncus nisi.
  • 14. float propriedade clear (left, right, both) vários elementos com float: left; com clear clear: both; clear: both;
  • 15. position position: relative; body id = “elemento1” #elemento3 { position: relative; top: 30px; left: 30px; id = “elemento3” } id = “elemento2”
  • 16. position position: absolute; body id = “elemento1” id = “elemento3” #elemento3 { position: absolute; top: 30px; left: 30px; } id = “elemento2”
  • 17. position position: absolute; e position: relative; body id = “elemento1” #elemento2 { position: relative; } id = “elemento3” #elemento3 { position: absolute; top: 30px; left: 30px; } id = “elemento2”
  • 18. position not on my watch! position: fixed; internet explorer 6
  • 21. tipos de páginas • página de entrada • arquivo • ano • mês • dia • página do post • comentários ao post • página para comentar • página dos resultados da pesquisa • página com todas as tags
  • 22. composição de um post • título • data • conteúdo • metadata (tags, mood, música) • assinatura • autor • links (do post, comentar, comentários) • widgets (sharethis)
  • 23. componentes (sidebar) • título • conteúdo
  • 24. ferramentas • firefox (duh..) plugins: • firebug • web developer toolbar • colorzilla • measureit
  • 25. compatibilidade • Internet Explorer 6, 7, 8 • Firefox 3.* • Safari 4.* • Chrome 4.*

Notas do Editor