SlideShare una empresa de Scribd logo
1 de 48
Descargar para leer sin conexión
Pro CSS
                  Simple, kludge free web design

Tuesday, January 29, 13
Agenda

                   CSS Selectors

                   CSS Properties

                   Page Layouts

                   Tips & Tricks




Tuesday, January 29, 13
CSS Selectors




Tuesday, January 29, 13
Class Selector
                   Selects all elements having a class attribute
    CSS            img.thumb { width: 32px; height: 32px; }



    HTML
                   <div class="gallery">
                       <ul>
                            <li><img class="thumb" src="img1.png" /></li>
                            <li><img class="thumb" src="img2.png" /></li>
                            <li><img class="thumb" src="img3.png" /></li>
                       </ul>
                   </div>




Tuesday, January 29, 13
ID Selector
                   Select a node based on id
    CSS             #content { width: 960px; margin: 0 auto; }




    HTML            <div id="content">
                    </div>




Tuesday, January 29, 13
Descendants Selector
                   Select all descendants of the given element
    CSS
                   .gallery img { border: 2px solid blue; }


    HTML
                   <div class="gallery">
                       <ul>
                            <li><img src="img1.png" /></li>
                            <li><img src="img2.png" /></li>
                            <li><img src="img3.png" /></li>
                       </ul>
                   </div>




Tuesday, January 29, 13
Child Selector
                   Select a direct child.
                   CSS2.1 Selector. IE8 and above
     CSS
                    .header > h1 { font-size: 1.8em; font-weight: bold; }


    HTML            <div class="header">
                        <h1>Welcome Home</h1>
                        <div class="menu">
                            <h1>About</h1>
                            <h1>Gallery</h1>
                            <h1>Contact</h1>
                        </div>
                    </div>



Tuesday, January 29, 13
Attribute Selector
                   Select an element with a specific attribute
                   CSS2.1 Selector. IE7 And above

    CSS             input[type="text"] { border: 2px solid blue; }



   HTML            <form>
                       <input type="text" name="name" />
                       <input type="text" name="phone" />
                       <input type="submit" value="Go" />
                   </form>




Tuesday, January 29, 13
Enter CSS3


                   More selectors

                   Less clutter in HTML




Tuesday, January 29, 13
Advanced Attribute
                   Select an attribute that “starts with”
                   IE7 and above
                   a[href^="mailto:"] {
     CSS               background: url(/images/icn-email.png);
                   }



   HTML            <a href="/work">Work</a>
                   <a href="/about">About</a>
                   <a href="mailto:admin@work.com">Contact</a>




Tuesday, January 29, 13
Advanced Attribute
                   Select an attribute that “ends with”
                   IE7 and above

     CSS            a[href$="pdf"] {
                        background: url(/images/icn-pdf.png);
                    }


   HTML
                    <a href="report.pdf">Report</a>




Tuesday, January 29, 13
Pseudo Selectors

                   :first-child

                   :last-child

                   :nth-child, :nth-of-type

                   :not

                   :enabled, :disabled, :checked



Tuesday, January 29, 13
:nth-child
        td { padding: 2px; }
        tr td:first-child { width: 100px; }
        tr:nth-child(2n) { background: #ccc; }
                                                 Dollar   USA
        <table>
            <tr>
                <td>Dollar</td>
                <td>USA</td>
            </tr>
            <tr>
                <td>Pound</td>
                                                 Pound    Great Britain
                <td>Great Britain</td>
            </tr>
            <tr>
                <td>Yen</td>
                <td>Japan</td>
            </tr>    
            <tr>
                <td>Euro</td>
                                                 Yen      Japan
                <td>EMU</td>
            </tr>   
        </table>




Tuesday, January 29, 13
:nth-child

                   An element that has an+b-1 siblings before in
                   the document tree

                   Very useful for zebra tables

                   Can save html classes: first, second, third, etc.




Tuesday, January 29, 13
:nth-of-type


                   Has an+b-1 siblings with the same expanded
                   element name before

                   Used for mixed type containers




Tuesday, January 29, 13
Psudo Elements

                   Create abstractions about the document tree
                   beyond html

                   Goal: Simplify your html

                   ::first-letter, ::first-line, ::before, ::after




Tuesday, January 29, 13
Drop Caps

                   p { margin-top: 20px; }
                   p::first-letter {
                       font: 2em zapfino;
                       float: left;
                       margin: -22px 15px 0 0;
                   }




Tuesday, January 29, 13
:before and :after




Tuesday, January 29, 13
Demos:
                   Intro: http://jsfiddle.net/kcYUM/1/

                   Shapes: http://css-tricks.com/examples/
                   ShapesOfCSS/

                   Multiple borders: http://nicolasgallagher.com/
                   multiple-backgrounds-and-borders-with-css2/
                   demo/borders.html

                   Ribbons: http://jsfiddle.net/y5u3k/



Tuesday, January 29, 13
Lab
                                            All 3 A’s together

                   Write a CSS selector      <body>
                                                 <nav>
                                                     <ul>
                   for each marked                       <li><a href="#">Home</a></li>
                                                         <li><a href="#">About</a></li>
                   element in the                        <li><a href="#">Schedule</a></li>
                                                     </ul>

                   following HTML.               </nav>
                                                 
                                                 <div id="page-main">
                                                     <article>

                   Test your work by                     <p>Pellentesque habitant mor.</p>
                                                         <ul>

                   changing background                       <li>Lorem ipsum .</li>
                                                             <li>Aliquam tin.</li>
                                                             <li>Vestibulum .</li>
                   color for the selected                </ul>   
                                                          <p>Pellentesque habitant mor.</p>   
                                                                                              
                   element                           </article>
                                                 </div>
                                             </body>


                   http://jsfiddle.net/
                   9GYsp/
Tuesday, January 29, 13
CSS Conflicts




Tuesday, January 29, 13
What Happens Here ?
      CSS                 p    { color: red; }
                          .foo { color: blue; }



    HTML                  <p class="foo">Hello</p>




Tuesday, January 29, 13
What Happens Here ?
      CSS                 p    { color: red; }
                          .foo { color: blue; }



    HTML                  <p class="foo">Hello</p>

     RESULT               Hello



Tuesday, January 29, 13
Selector Specificity

                   Number of IDs * 100

                   Number of class, attributes, pseudo-classes * 10

                   Number of type, pseudo elements

                   Add it all to get the specificity

                   Selector with the larger specificity wins



Tuesday, January 29, 13
CSS Faceoff
        type              p         .foo


        id                0 * 100   0 * 100


        classes           0 * 10    1 * 10


        type              1*1       0*1


        total:            1         10




Tuesday, January 29, 13
CSS Faceoff

                   Who Wins ?

                   #slider

                   OR

                   .twocol .container .primary .content ul




Tuesday, January 29, 13
CSS Faceoff
                                    .twocol .container .primary
        type              #slider
                                    .content ul


        id                1 * 100   0 * 100


        classes           0 * 10    4 * 10


        type              0*1       1*1


        total:            100       41




Tuesday, January 29, 13
CSS Faceoff


                   .container .external <=> .container a[rel=”external”]



                   div ul li a.item    <=> div.nav li a




Tuesday, January 29, 13
IE < 9 Shim

                   Most interesting
                   selectors require a
                   modern browser

                   If your clients don’t
                   have one - use a shim




Tuesday, January 29, 13
CSS Properties


                   float and positioning

                   display: block, inline, inline-block

                   background




Tuesday, January 29, 13
Floats

                   Takes an element out
                   of the normal layout
                   context

                   “wrap” all other
                   contents around it




Tuesday, January 29, 13
position: absolute
                   Draw an element in a
                   specific location.

                   The element is painted
                   in another “layer”

                   Positioning is relative
                   to a container having
                   non static positioning



Tuesday, January 29, 13
Display: inline/block
                   Block elements occupy an entire line

                   Inline elements are placed inside box elements

                   Common block elements: div, h1..h6, p, ul, ol, dl,
                   li, dt, dd, table, blockquote, pre, form

                   Common inline elements: span, a, strong, em, img,
                   br, input

                   inline-block combines the two


Tuesday, January 29, 13
Demo


                   Implementing a top navigation menu with inline-
                   block




Tuesday, January 29, 13
Lab

                   Fill in the CSS to
                   create the grid on the
                   right

                   HTML at:
                   https://
                   gist.github.com/
                   4286294




Tuesday, January 29, 13
Page Layouts


                   Fixed layout

                   Fluid (liquid) layout

                   Adaptive layout




Tuesday, January 29, 13
Fixed Width Layout


                   Usually 960px or 760px wide

                   Keep your designers happy

                   Example: http://www.petplace.com/




Tuesday, January 29, 13
Fluid Width Layouts
                   Use percentages for widths

                   Can make better use of screen real estate than
                   fixed

                   Use min-width, max-width to prevent surprises

                   Remember: Page must be usable at all times

                   Example: http://graybit.com/main.php



Tuesday, January 29, 13
Adaptive Layout

                   Uses media queries to make a smart decision
                   about the layout

                   Makes the best use of screen real estate

                   Takes the most work to implement

                   Example: mediaqueri.es




Tuesday, January 29, 13
Choosing Layout

                   Be careful with fluid layouts - easiest to build,
                   most difficult to test

                   Use fixed layout when targeting only one client

                   Use adaptive layout when targeting many client
                   platforms




Tuesday, January 29, 13
960 Grid

                   For fixed grid layouts, no need to reinvent the
                   wheel.

                   960grid is a set of CSS files for implementing a
                   grid system




Tuesday, January 29, 13
Common CSS

                   Centering elements

                   Showing/Hiding elements

                   Box punching

                   CSS Sprites




Tuesday, January 29, 13
Centering elements
                   Use align: center to
                   center text inside a
                   block container

                   Use margin: 0 auto to
                   center a block

                   Use line-height to
                   center vertically



Tuesday, January 29, 13
Showing/Hiding
                   Elements
                   Use display: none to
                   completely remove an
                   element from the page

                   Use visibility: hidden to
                   hide an element.
                   Hidden elements still
                   effect page layout




Tuesday, January 29, 13
Box Punching


                   Fiddle: http://
                   jsfiddle.net/ynonp/
                   PqtkB/1/




Tuesday, January 29, 13
CSS Sprites

                   One image file with many small images

                   Save bandwidth

                   Better performance

                   Demo




Tuesday, January 29, 13
Q&A
Tuesday, January 29, 13
Thank You


                   Ynon Perek

                   ynon@ynonperek.com

                   ynonperek.com




Tuesday, January 29, 13

Más contenido relacionado

Similar a 03 css

モダンなCSS設計パターンを考える
モダンなCSS設計パターンを考えるモダンなCSS設計パターンを考える
モダンなCSS設計パターンを考える拓樹 谷
 
Hypertext markup language(html)
Hypertext markup language(html)Hypertext markup language(html)
Hypertext markup language(html)Jayson Cortez
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to BootstrapRon Reiter
 
Polymer - Lego for the web!
Polymer - Lego for the web!Polymer - Lego for the web!
Polymer - Lego for the web!Codemotion
 
jQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisjQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisPablo Garrido
 
LIS3353 SP12 Week 4
LIS3353 SP12 Week 4LIS3353 SP12 Week 4
LIS3353 SP12 Week 4Amanda Case
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AnglePablo Godel
 
Dapper Drupal - Custom Tailored Drupal Themes
Dapper Drupal - Custom Tailored Drupal ThemesDapper Drupal - Custom Tailored Drupal Themes
Dapper Drupal - Custom Tailored Drupal Themeskilltheliterate
 
The power of CSS pseudo-elements
The power of CSS pseudo-elementsThe power of CSS pseudo-elements
The power of CSS pseudo-elementsGeoffrey Croftє
 
Introduction to html5 and css3
Introduction to html5 and css3Introduction to html5 and css3
Introduction to html5 and css3Sunny Batabyal
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Likitha47
 
Web Performance: 3 Stages to Success
Web Performance: 3 Stages to SuccessWeb Performance: 3 Stages to Success
Web Performance: 3 Stages to SuccessAustin Gil
 
04 jQuery Mobile
04 jQuery Mobile04 jQuery Mobile
04 jQuery MobileYnon Perek
 
Performance & Responsive Web Design
Performance & Responsive Web DesignPerformance & Responsive Web Design
Performance & Responsive Web DesignZach Leatherman
 
Learn CSS From Scratch
Learn CSS From ScratchLearn CSS From Scratch
Learn CSS From Scratchecobold
 

Similar a 03 css (20)

モダンなCSS設計パターンを考える
モダンなCSS設計パターンを考えるモダンなCSS設計パターンを考える
モダンなCSS設計パターンを考える
 
CSS Master Class: Part 1
CSS Master Class: Part 1CSS Master Class: Part 1
CSS Master Class: Part 1
 
Hypertext markup language(html)
Hypertext markup language(html)Hypertext markup language(html)
Hypertext markup language(html)
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to Bootstrap
 
Polymer - Lego for the web!
Polymer - Lego for the web!Polymer - Lego for the web!
Polymer - Lego for the web!
 
Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 
Yuihacku iitd-sumana
Yuihacku iitd-sumanaYuihacku iitd-sumana
Yuihacku iitd-sumana
 
jQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisjQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveis
 
LIS3353 SP12 Week 4
LIS3353 SP12 Week 4LIS3353 SP12 Week 4
LIS3353 SP12 Week 4
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New Angle
 
Dapper Drupal - Custom Tailored Drupal Themes
Dapper Drupal - Custom Tailored Drupal ThemesDapper Drupal - Custom Tailored Drupal Themes
Dapper Drupal - Custom Tailored Drupal Themes
 
hellowired_instructions
hellowired_instructionshellowired_instructions
hellowired_instructions
 
The power of CSS pseudo-elements
The power of CSS pseudo-elementsThe power of CSS pseudo-elements
The power of CSS pseudo-elements
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 
Introduction to html5 and css3
Introduction to html5 and css3Introduction to html5 and css3
Introduction to html5 and css3
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01
 
Web Performance: 3 Stages to Success
Web Performance: 3 Stages to SuccessWeb Performance: 3 Stages to Success
Web Performance: 3 Stages to Success
 
04 jQuery Mobile
04 jQuery Mobile04 jQuery Mobile
04 jQuery Mobile
 
Performance & Responsive Web Design
Performance & Responsive Web DesignPerformance & Responsive Web Design
Performance & Responsive Web Design
 
Learn CSS From Scratch
Learn CSS From ScratchLearn CSS From Scratch
Learn CSS From Scratch
 

Más de Ynon Perek

09 performance
09 performance09 performance
09 performanceYnon Perek
 
Mobile Web Intro
Mobile Web IntroMobile Web Intro
Mobile Web IntroYnon Perek
 
Qt multi threads
Qt multi threadsQt multi threads
Qt multi threadsYnon Perek
 
Mobile Devices
Mobile DevicesMobile Devices
Mobile DevicesYnon Perek
 
Architecture app
Architecture appArchitecture app
Architecture appYnon Perek
 
Unit Testing JavaScript Applications
Unit Testing JavaScript ApplicationsUnit Testing JavaScript Applications
Unit Testing JavaScript ApplicationsYnon Perek
 
How to write easy-to-test JavaScript
How to write easy-to-test JavaScriptHow to write easy-to-test JavaScript
How to write easy-to-test JavaScriptYnon Perek
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and RubyYnon Perek
 
Introduction To Web Application Testing
Introduction To Web Application TestingIntroduction To Web Application Testing
Introduction To Web Application TestingYnon Perek
 
Qt Design Patterns
Qt Design PatternsQt Design Patterns
Qt Design PatternsYnon Perek
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application SecurityYnon Perek
 

Más de Ynon Perek (20)

Regexp
RegexpRegexp
Regexp
 
Html5 intro
Html5 introHtml5 intro
Html5 intro
 
09 performance
09 performance09 performance
09 performance
 
Mobile Web Intro
Mobile Web IntroMobile Web Intro
Mobile Web Intro
 
Qt multi threads
Qt multi threadsQt multi threads
Qt multi threads
 
Vimperl
VimperlVimperl
Vimperl
 
Syllabus
SyllabusSyllabus
Syllabus
 
Mobile Devices
Mobile DevicesMobile Devices
Mobile Devices
 
Network
NetworkNetwork
Network
 
Architecture app
Architecture appArchitecture app
Architecture app
 
Cryptography
CryptographyCryptography
Cryptography
 
Unit Testing JavaScript Applications
Unit Testing JavaScript ApplicationsUnit Testing JavaScript Applications
Unit Testing JavaScript Applications
 
How to write easy-to-test JavaScript
How to write easy-to-test JavaScriptHow to write easy-to-test JavaScript
How to write easy-to-test JavaScript
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
 
Introduction To Web Application Testing
Introduction To Web Application TestingIntroduction To Web Application Testing
Introduction To Web Application Testing
 
Accessibility
AccessibilityAccessibility
Accessibility
 
Angularjs
AngularjsAngularjs
Angularjs
 
Js memory
Js memoryJs memory
Js memory
 
Qt Design Patterns
Qt Design PatternsQt Design Patterns
Qt Design Patterns
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 

Último

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

03 css

  • 1. Pro CSS Simple, kludge free web design Tuesday, January 29, 13
  • 2. Agenda CSS Selectors CSS Properties Page Layouts Tips & Tricks Tuesday, January 29, 13
  • 4. Class Selector Selects all elements having a class attribute CSS img.thumb { width: 32px; height: 32px; } HTML <div class="gallery"> <ul> <li><img class="thumb" src="img1.png" /></li> <li><img class="thumb" src="img2.png" /></li> <li><img class="thumb" src="img3.png" /></li> </ul> </div> Tuesday, January 29, 13
  • 5. ID Selector Select a node based on id CSS #content { width: 960px; margin: 0 auto; } HTML <div id="content"> </div> Tuesday, January 29, 13
  • 6. Descendants Selector Select all descendants of the given element CSS .gallery img { border: 2px solid blue; } HTML <div class="gallery"> <ul> <li><img src="img1.png" /></li> <li><img src="img2.png" /></li> <li><img src="img3.png" /></li> </ul> </div> Tuesday, January 29, 13
  • 7. Child Selector Select a direct child. CSS2.1 Selector. IE8 and above CSS .header > h1 { font-size: 1.8em; font-weight: bold; } HTML <div class="header"> <h1>Welcome Home</h1> <div class="menu"> <h1>About</h1> <h1>Gallery</h1> <h1>Contact</h1> </div> </div> Tuesday, January 29, 13
  • 8. Attribute Selector Select an element with a specific attribute CSS2.1 Selector. IE7 And above CSS input[type="text"] { border: 2px solid blue; } HTML <form> <input type="text" name="name" /> <input type="text" name="phone" /> <input type="submit" value="Go" /> </form> Tuesday, January 29, 13
  • 9. Enter CSS3 More selectors Less clutter in HTML Tuesday, January 29, 13
  • 10. Advanced Attribute Select an attribute that “starts with” IE7 and above a[href^="mailto:"] { CSS background: url(/images/icn-email.png); } HTML <a href="/work">Work</a> <a href="/about">About</a> <a href="mailto:admin@work.com">Contact</a> Tuesday, January 29, 13
  • 11. Advanced Attribute Select an attribute that “ends with” IE7 and above CSS a[href$="pdf"] { background: url(/images/icn-pdf.png); } HTML <a href="report.pdf">Report</a> Tuesday, January 29, 13
  • 12. Pseudo Selectors :first-child :last-child :nth-child, :nth-of-type :not :enabled, :disabled, :checked Tuesday, January 29, 13
  • 13. :nth-child td { padding: 2px; } tr td:first-child { width: 100px; } tr:nth-child(2n) { background: #ccc; } Dollar USA <table>     <tr>         <td>Dollar</td>         <td>USA</td>     </tr>     <tr>         <td>Pound</td> Pound Great Britain         <td>Great Britain</td>     </tr>     <tr>         <td>Yen</td>         <td>Japan</td>     </tr>         <tr>         <td>Euro</td> Yen Japan         <td>EMU</td>     </tr>    </table> Tuesday, January 29, 13
  • 14. :nth-child An element that has an+b-1 siblings before in the document tree Very useful for zebra tables Can save html classes: first, second, third, etc. Tuesday, January 29, 13
  • 15. :nth-of-type Has an+b-1 siblings with the same expanded element name before Used for mixed type containers Tuesday, January 29, 13
  • 16. Psudo Elements Create abstractions about the document tree beyond html Goal: Simplify your html ::first-letter, ::first-line, ::before, ::after Tuesday, January 29, 13
  • 17. Drop Caps p { margin-top: 20px; } p::first-letter {     font: 2em zapfino;     float: left;     margin: -22px 15px 0 0; } Tuesday, January 29, 13
  • 18. :before and :after Tuesday, January 29, 13
  • 19. Demos: Intro: http://jsfiddle.net/kcYUM/1/ Shapes: http://css-tricks.com/examples/ ShapesOfCSS/ Multiple borders: http://nicolasgallagher.com/ multiple-backgrounds-and-borders-with-css2/ demo/borders.html Ribbons: http://jsfiddle.net/y5u3k/ Tuesday, January 29, 13
  • 20. Lab All 3 A’s together Write a CSS selector <body>     <nav>         <ul> for each marked             <li><a href="#">Home</a></li>             <li><a href="#">About</a></li> element in the             <li><a href="#">Schedule</a></li>         </ul> following HTML.     </nav>          <div id="page-main">         <article> Test your work by             <p>Pellentesque habitant mor.</p>             <ul> changing background                 <li>Lorem ipsum .</li>                 <li>Aliquam tin.</li>                 <li>Vestibulum .</li> color for the selected             </ul>    <p>Pellentesque habitant mor.</p>      element         </article>     </div> </body> http://jsfiddle.net/ 9GYsp/ Tuesday, January 29, 13
  • 22. What Happens Here ? CSS p    { color: red; } .foo { color: blue; } HTML <p class="foo">Hello</p> Tuesday, January 29, 13
  • 23. What Happens Here ? CSS p    { color: red; } .foo { color: blue; } HTML <p class="foo">Hello</p> RESULT Hello Tuesday, January 29, 13
  • 24. Selector Specificity Number of IDs * 100 Number of class, attributes, pseudo-classes * 10 Number of type, pseudo elements Add it all to get the specificity Selector with the larger specificity wins Tuesday, January 29, 13
  • 25. CSS Faceoff type p .foo id 0 * 100 0 * 100 classes 0 * 10 1 * 10 type 1*1 0*1 total: 1 10 Tuesday, January 29, 13
  • 26. CSS Faceoff Who Wins ? #slider OR .twocol .container .primary .content ul Tuesday, January 29, 13
  • 27. CSS Faceoff .twocol .container .primary type #slider .content ul id 1 * 100 0 * 100 classes 0 * 10 4 * 10 type 0*1 1*1 total: 100 41 Tuesday, January 29, 13
  • 28. CSS Faceoff .container .external <=> .container a[rel=”external”] div ul li a.item <=> div.nav li a Tuesday, January 29, 13
  • 29. IE < 9 Shim Most interesting selectors require a modern browser If your clients don’t have one - use a shim Tuesday, January 29, 13
  • 30. CSS Properties float and positioning display: block, inline, inline-block background Tuesday, January 29, 13
  • 31. Floats Takes an element out of the normal layout context “wrap” all other contents around it Tuesday, January 29, 13
  • 32. position: absolute Draw an element in a specific location. The element is painted in another “layer” Positioning is relative to a container having non static positioning Tuesday, January 29, 13
  • 33. Display: inline/block Block elements occupy an entire line Inline elements are placed inside box elements Common block elements: div, h1..h6, p, ul, ol, dl, li, dt, dd, table, blockquote, pre, form Common inline elements: span, a, strong, em, img, br, input inline-block combines the two Tuesday, January 29, 13
  • 34. Demo Implementing a top navigation menu with inline- block Tuesday, January 29, 13
  • 35. Lab Fill in the CSS to create the grid on the right HTML at: https:// gist.github.com/ 4286294 Tuesday, January 29, 13
  • 36. Page Layouts Fixed layout Fluid (liquid) layout Adaptive layout Tuesday, January 29, 13
  • 37. Fixed Width Layout Usually 960px or 760px wide Keep your designers happy Example: http://www.petplace.com/ Tuesday, January 29, 13
  • 38. Fluid Width Layouts Use percentages for widths Can make better use of screen real estate than fixed Use min-width, max-width to prevent surprises Remember: Page must be usable at all times Example: http://graybit.com/main.php Tuesday, January 29, 13
  • 39. Adaptive Layout Uses media queries to make a smart decision about the layout Makes the best use of screen real estate Takes the most work to implement Example: mediaqueri.es Tuesday, January 29, 13
  • 40. Choosing Layout Be careful with fluid layouts - easiest to build, most difficult to test Use fixed layout when targeting only one client Use adaptive layout when targeting many client platforms Tuesday, January 29, 13
  • 41. 960 Grid For fixed grid layouts, no need to reinvent the wheel. 960grid is a set of CSS files for implementing a grid system Tuesday, January 29, 13
  • 42. Common CSS Centering elements Showing/Hiding elements Box punching CSS Sprites Tuesday, January 29, 13
  • 43. Centering elements Use align: center to center text inside a block container Use margin: 0 auto to center a block Use line-height to center vertically Tuesday, January 29, 13
  • 44. Showing/Hiding Elements Use display: none to completely remove an element from the page Use visibility: hidden to hide an element. Hidden elements still effect page layout Tuesday, January 29, 13
  • 45. Box Punching Fiddle: http:// jsfiddle.net/ynonp/ PqtkB/1/ Tuesday, January 29, 13
  • 46. CSS Sprites One image file with many small images Save bandwidth Better performance Demo Tuesday, January 29, 13
  • 48. Thank You Ynon Perek ynon@ynonperek.com ynonperek.com Tuesday, January 29, 13