SlideShare uma empresa Scribd logo
1 de 28
If you can’t read this, move closer




  Making the hard stuff
fun & easy with YUI CSS


                                                 Vani Raja
                                          vani@webchic.net
               http://webchic.net/talks/yui/

                                               OSCON ’07

                                                             r7
YUI CSS: Why It Rocks
★ A handful of predefined styles that will rock
    your world.
★ Over 750 page layout possibilities in under 3
    minutes – minimal html changes!
★ A-Grade browser support (supported and tested by
  Yahoo)

★ Normalize all HTML elements to ensure
    similar display across browsers.
★ Customized table-less page layouts in 10
    minutes, without two Advil.
Basic CSS terminology

     ★ div – html element
           Essential building block of your
           layout.
     ★ id – selector
           One unique per page. Like your driver’s license.
           #header, <div id=”header”></div>


     ★ class –selector
           Up to many per page.
           .caption, <span class=”caption”></span>

http://flickr.com/photos/randomlyhumming/247604167/
The Files
★normalizes margins, padding, etc.
 reset.css

★sets font baseline & even scaling
 fonts.css

★defines classes for preset height
 grids.css
   and widths of div html elements
reset.css
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h
6,pre,form,fieldset,input,textarea,p,blockq
uote,th,td {margin:0;padding:0;}
table {border-collapse:collapse;border-
spacing:0;} fieldset,img {border:0;}
address,caption,cite,code,dfn,em,strong,th,
var {font-style:normal;font-weight:normal;}
ol,ul {list-style:none;}caption,th {text-
align:left;} h1,h2,h3,h4,h5,h6 {font-size:
100%;font-weight:normal;} q:before,q:after
{content:'';}abbr,acronym {border:0;}
what reset does
★ starts with everything normalized, zeroed and
   borderless
★ margin & padding: 0
   body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,field
   set,input,textarea,p,blockquote,th,td


★ border: 0
   fieldset,img,abbr
fonts.css
 body {font:13px arial,helvetica,clean,sans-
 serif;*font-size:small;*font:x-small;}
 table {font-size:inherit;font:100%;}
 select, input, textarea {font:99%
 arial,helvetica,clean,sans-serif;}
 pre, code {font:115% monospace;*font-size:
 100%;}body * {line-height:1.22em;}


★ handles uneven font-scaling
★ sets standard line-height across browsers
Using YUI CSS
★ Download the latest build and use from your
    ~/css directory
★ Or link to files served from Yahoo! servers:
    <link rel=quot;stylesheetquot; type=quot;text/cssquot; href=quot;http://
    yui.yahooapis.com/2.2.2/build/reset-fonts-grids/reset-
    fonts-grids.cssquot; />


       ★ (a combined file; minimized and
             compressed served by Yahoo)
★ First, include YUI css files.
    Either download, or serve from Yahoo

★ Explicitly set h1, h2, p, etc. in your own
    master.css
grids.css
woohoo – this is the cool stuff!
Build Your Page: doc
  page width IDs
                                                             *
   doc    750px
  doc2    950px
  doc3    100%



<div id=quot;docquot;>

 <div id=quot;hdquot;> Header </div>

 <div id=quot;bdquot;> Body </div>

 <div id=quot;ftquot;> Footer </div>
</div>             * border colors have been applied for clarity
Build Your Page: template


<div id=quot;docquot; class=quot;yui-t1quot;>                  template classes
   <div id=quot;hdquot;> Header </div>
                                            .yui-t1     160px on left
   <div id=quot;bdquot;>
       <div id=quot;yui-mainquot;>                  .yui-t2     180px on left
          <div class=quot;yui-bquot;> Main </div>
                                            .yui-t3     300px on left
       </div>
                                            .yui-t4    180px on right
       <div class=quot;yui-bquot;> Side </div>
   </div>                                   .yui-t5    240px on right
   <div id=quot;ftquot;> Footer </div>
                                            .yui-t6    300px on right
</div>
                                                        One full-width
                                            .yui-t7
                                                          column
         (“yui-b” = “yui block”)
Build Your Page:
                          template presets
.yui-t2 - 180px on left




.yui-t3 - 300px on left




                                              .yui-t4 - 180px on right




                                              .yui-t5 - 240px on right
Build Your Page: grids
★ Instant two- to four-column sections
★ Safe nesting
★ Source order independent
    <div class=quot;yui-gquot;>
    
 <div class=quot;yui-u firstquot;></div>
    
 <div class=quot;yui-uquot;></div>
    </div>
Cascading Style Sheets
                                Abstract and re-use!




http://flickr.com/photos/cayusa/477619516/
Cascade for Simple Folk
          ★ Last style applied takes
             effect!
             ★ Doesn’t matter if in
                 single/multiple files.
             ★ Set all colors in one
                 file, fonts in another
                 file, etc.
The Cascade
<link rel=”stylesheet” src=”master.css” ...>
<link rel=”stylesheet” src=”winter.css” ...>

                                   /* master.css */
★ Use to override previous         .tagline {
   styles                            color: #ccc;
                                   }
★ Create custom themes for
   users, seasons, accessibility   /* winter.css */
★ Separation of concerns:          .tagline {
                                     color: #aaa;
   layout.css vs. winter.css
                                   }
A Sense of Style
  ★ Use semantic names as much as
     possible
     #logo, .tagline, .thumbnail,
     #profile_gallery


  ★ Keep the non-semantic names
     to a bare minimum if used at all
     .black_line, #left_whitespace


  ★ Indentation & comments. (Can
     be stripped later.)
Use “standards mode”
<!DOCTYPE HTML PUBLIC quot;-//W3C//DTD HTML 4.01//ENquot;
quot;http://www.w3.org/TR/html4/strict.dtdquot;>

  Yeah, so it takes a little more attention to detail, but...

                          ★ Trigger a more consistent
                              HTML interpretation across
                              browsers
                          ★ Accessibility-friendly
                          ★ Don’t be MySpace
Top 5 FAQ
 in under 5 minutes!
How do floats work?
  img.thumbnail { float: left; }


★ Don’t “align” - float!
★ Like a rock in a stream, other elements
    FLOAT around it.
★ To make the next element CLEAR the
    bottom of your floated item, clear it.

      div#gallery { clear: left; }
Float Your Cares Away
            Or, the benefits of using float.


★ Mimic table layouts without the table!
★ Specific per-column do that!) & padding
                         margins
  (Bet your tables can’t

★ Progressive downloading in floated column
    layouts.
★ For the skinny, check out Max Design’s
    Floatutorial.
    http://css.maxdesign.com.au/floatutorial/
What about positioning?
            position: absolute;
★    “Where does this element go in relation to
     its PARENT?”

    div#absolute {
    /* parent is body */
        position: absolute;
        top: 40px;
        left: 40px;
    }



★    Removed from regular document flow.
More positioning...
            position: relative;
★    “Where does this element go in relation to
     its MARKUP?”

    div#relative_box {
        position: relative;
        top: 40px;
        left: 40px;
    }




★    Previous place held occupied!
Mixing relative and
    absolute positioning



★ To absolutely position something inside an
    element, set the wrapping element to
    position: relative.

★ For more on positioning, peek at BarelyFitz
    Designs’ Learn CSS Positioning in Ten Steps.
Inline divs? Block span?
★ All elements display as either block or
             by default.
    inline

★ They can also be forced to do the opposite!
★ Give a span a height and width by adding
    display: block
★ K.I.S.S. - Ask yourself if there’s a better
    markup element to use instead!
   h1#subheader {
     display: inline;
                           =
     text-align: left;         <span></span>
     font: 10px Ar...
   }
So, what about tables?
    ★ Leave tables for large amounts of tabular data.
    ★ Learn a solid table-replacement CSS
        technique.
div.thumbnail {
    float: left;              <div   class=”thumbnail”>!</div>
    width: 100px;             <div   class=”thumbnail”>!</div>
    height: 100px;            <div   class=”thumbnail”>!</div>
    margin: 0 20px 20px 0;    <div   class=”thumbnail”>!</div>
}
Stuff I’d Recommend :-)
★ YUI CSS Cheatsheet!
   http://yuiblog.com/assets/pdf/cheatsheets/css.pdf



★ TextMate, Transmit, CSSEdit, Coda, Free Ruler,
   DigitalColor Meter (OS X)
★ CSSViewer, Firebug (Firefox), Opera 9/Mini
★ Dolor Sit Amet (OSX/Dashboard)
★ Web Developer’s Handbook
   http://www.alvit.de/handbook/
Thank you!
•   Slides
    http://webchic.net/talks/yui

•   Yahoo Grids
    http://developer.yahoo.com/yui/grids/

•   See it in action!
    http://www.yellowbot.com
    http://www.webchic.net

•   More questions? Need help?
    vani@webchic.net

Mais conteúdo relacionado

Mais procurados

Modular HTML & CSS Turbo Workshop
Modular HTML & CSS Turbo WorkshopModular HTML & CSS Turbo Workshop
Modular HTML & CSS Turbo WorkshopShay Howe
 
Be nice to your designers
Be nice to your designersBe nice to your designers
Be nice to your designersPai-Cheng Tao
 
Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)Marc Grabanski
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Erin M. Kidwell
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreRuss Weakley
 
CSS3: Are you experienced?
CSS3: Are you experienced?CSS3: Are you experienced?
CSS3: Are you experienced?Denise Jacobs
 
Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Hajas Tamás
 
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone developmentiPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone developmentEstelle Weyl
 
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSSObject-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSSLi-Wei Lu
 
Scalable and Modular CSS FTW!
Scalable and Modular CSS FTW!Scalable and Modular CSS FTW!
Scalable and Modular CSS FTW!FITC
 
CSS in React
CSS in ReactCSS in React
CSS in ReactJoe Seifi
 
Developing Your Ultimate Package
Developing Your Ultimate PackageDeveloping Your Ultimate Package
Developing Your Ultimate PackageSimon Collison
 
CSS3 - is everything we used to do wrong?
CSS3 - is everything we used to do wrong? CSS3 - is everything we used to do wrong?
CSS3 - is everything we used to do wrong? Russ Weakley
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009Ralph Whitbeck
 
BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12ucbdrupal
 
Responsive Websites
Responsive WebsitesResponsive Websites
Responsive WebsitesJoe Seifi
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic templatevathur
 

Mais procurados (20)

Modular HTML & CSS Turbo Workshop
Modular HTML & CSS Turbo WorkshopModular HTML & CSS Turbo Workshop
Modular HTML & CSS Turbo Workshop
 
HTML News Packages Lesson
HTML News Packages LessonHTML News Packages Lesson
HTML News Packages Lesson
 
Be nice to your designers
Be nice to your designersBe nice to your designers
Be nice to your designers
 
Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
CSS3: Are you experienced?
CSS3: Are you experienced?CSS3: Are you experienced?
CSS3: Are you experienced?
 
Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)Future-proof styling in Drupal (8)
Future-proof styling in Drupal (8)
 
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone developmentiPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
 
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSSObject-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
 
Scalable and Modular CSS FTW!
Scalable and Modular CSS FTW!Scalable and Modular CSS FTW!
Scalable and Modular CSS FTW!
 
CSS in React
CSS in ReactCSS in React
CSS in React
 
Developing Your Ultimate Package
Developing Your Ultimate PackageDeveloping Your Ultimate Package
Developing Your Ultimate Package
 
CSS3 - is everything we used to do wrong?
CSS3 - is everything we used to do wrong? CSS3 - is everything we used to do wrong?
CSS3 - is everything we used to do wrong?
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009
 
Intro to CSS3
Intro to CSS3Intro to CSS3
Intro to CSS3
 
BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12
 
Responsive Websites
Responsive WebsitesResponsive Websites
Responsive Websites
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
 
Slicing the web
Slicing the webSlicing the web
Slicing the web
 

Destaque

Os Lanphier Brashears
Os Lanphier BrashearsOs Lanphier Brashears
Os Lanphier Brashearsoscon2007
 
Solr Presentation5
Solr Presentation5Solr Presentation5
Solr Presentation5oscon2007
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Touroscon2007
 

Destaque (9)

Os Fogel
Os FogelOs Fogel
Os Fogel
 
Os Tucker
Os TuckerOs Tucker
Os Tucker
 
Os Kimsal
Os KimsalOs Kimsal
Os Kimsal
 
Os Furlong
Os FurlongOs Furlong
Os Furlong
 
Os Lanphier Brashears
Os Lanphier BrashearsOs Lanphier Brashears
Os Lanphier Brashears
 
Os Pruett
Os PruettOs Pruett
Os Pruett
 
Os Alrubaie
Os AlrubaieOs Alrubaie
Os Alrubaie
 
Solr Presentation5
Solr Presentation5Solr Presentation5
Solr Presentation5
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
 

Semelhante a Yuicss R7

3 coding101 fewd_lesson3_your_first_website 20210105
3 coding101 fewd_lesson3_your_first_website 202101053 coding101 fewd_lesson3_your_first_website 20210105
3 coding101 fewd_lesson3_your_first_website 20210105John Picasso
 
Doing it in style - creating beautiful sites, the web standards way / WebDD /...
Doing it in style - creating beautiful sites, the web standards way / WebDD /...Doing it in style - creating beautiful sites, the web standards way / WebDD /...
Doing it in style - creating beautiful sites, the web standards way / WebDD /...Patrick Lauke
 
HTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptHTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptraghavanp4
 
Implementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopImplementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopShoshi Roberts
 
From PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to lifeFrom PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to lifeDerek Christensen
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucksTim Wright
 
960 grid psd
960 grid psd960 grid psd
960 grid psdRaju Nag
 
Web I - 07 - CSS Frameworks
Web I - 07 - CSS FrameworksWeb I - 07 - CSS Frameworks
Web I - 07 - CSS FrameworksRandy Connolly
 
IV - CSS architecture
IV - CSS architectureIV - CSS architecture
IV - CSS architectureWebF
 

Semelhante a Yuicss R7 (20)

3 coding101 fewd_lesson3_your_first_website 20210105
3 coding101 fewd_lesson3_your_first_website 202101053 coding101 fewd_lesson3_your_first_website 20210105
3 coding101 fewd_lesson3_your_first_website 20210105
 
Class15
Class15Class15
Class15
 
Doing it in style - creating beautiful sites, the web standards way / WebDD /...
Doing it in style - creating beautiful sites, the web standards way / WebDD /...Doing it in style - creating beautiful sites, the web standards way / WebDD /...
Doing it in style - creating beautiful sites, the web standards way / WebDD /...
 
HTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.pptHTML Web Devlopment presentation css.ppt
HTML Web Devlopment presentation css.ppt
 
css.ppt
css.pptcss.ppt
css.ppt
 
css.ppt
css.pptcss.ppt
css.ppt
 
Think Vitamin CSS
Think Vitamin CSSThink Vitamin CSS
Think Vitamin CSS
 
Css web gallery
Css web galleryCss web gallery
Css web gallery
 
Implementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopImplementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 Workshop
 
Jina Bolton
Jina BoltonJina Bolton
Jina Bolton
 
Css
CssCss
Css
 
Please dont touch-3.6-jsday
Please dont touch-3.6-jsdayPlease dont touch-3.6-jsday
Please dont touch-3.6-jsday
 
Juggling
JugglingJuggling
Juggling
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Death of a Themer
Death of a ThemerDeath of a Themer
Death of a Themer
 
From PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to lifeFrom PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to life
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucks
 
960 grid psd
960 grid psd960 grid psd
960 grid psd
 
Web I - 07 - CSS Frameworks
Web I - 07 - CSS FrameworksWeb I - 07 - CSS Frameworks
Web I - 07 - CSS Frameworks
 
IV - CSS architecture
IV - CSS architectureIV - CSS architecture
IV - CSS architecture
 

Mais de oscon2007

Os Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman WiifmOs Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman Wiifmoscon2007
 
Performance Whack A Mole
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Moleoscon2007
 
Os Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman SwpOs Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman Swposcon2007
 
Os Berlin Dispelling Myths
Os Berlin Dispelling MythsOs Berlin Dispelling Myths
Os Berlin Dispelling Mythsoscon2007
 
Os Keysholistic
Os KeysholisticOs Keysholistic
Os Keysholisticoscon2007
 
Os Jonphillips
Os JonphillipsOs Jonphillips
Os Jonphillipsoscon2007
 
Os Urnerupdated
Os UrnerupdatedOs Urnerupdated
Os Urnerupdatedoscon2007
 
Adventures In Copyright Reform
Adventures In Copyright ReformAdventures In Copyright Reform
Adventures In Copyright Reformoscon2007
 
Railsconf2007
Railsconf2007Railsconf2007
Railsconf2007oscon2007
 
Oscon Mitchellbaker
Oscon MitchellbakerOscon Mitchellbaker
Oscon Mitchellbakeroscon2007
 
Os Pruett Sessionnotes
Os Pruett SessionnotesOs Pruett Sessionnotes
Os Pruett Sessionnotesoscon2007
 
Os Keyshacks
Os KeyshacksOs Keyshacks
Os Keyshacksoscon2007
 
Os Buncetutorial
Os BuncetutorialOs Buncetutorial
Os Buncetutorialoscon2007
 

Mais de oscon2007 (20)

Os Borger
Os BorgerOs Borger
Os Borger
 
Os Harkins
Os HarkinsOs Harkins
Os Harkins
 
Os Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman WiifmOs Fitzpatrick Sussman Wiifm
Os Fitzpatrick Sussman Wiifm
 
Os Bunce
Os BunceOs Bunce
Os Bunce
 
Performance Whack A Mole
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Mole
 
Os Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman SwpOs Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman Swp
 
Os Berlin Dispelling Myths
Os Berlin Dispelling MythsOs Berlin Dispelling Myths
Os Berlin Dispelling Myths
 
Os Keysholistic
Os KeysholisticOs Keysholistic
Os Keysholistic
 
Os Jonphillips
Os JonphillipsOs Jonphillips
Os Jonphillips
 
Os Urnerupdated
Os UrnerupdatedOs Urnerupdated
Os Urnerupdated
 
Adventures In Copyright Reform
Adventures In Copyright ReformAdventures In Copyright Reform
Adventures In Copyright Reform
 
Railsconf2007
Railsconf2007Railsconf2007
Railsconf2007
 
Oscon Mitchellbaker
Oscon MitchellbakerOscon Mitchellbaker
Oscon Mitchellbaker
 
Os Sharp
Os SharpOs Sharp
Os Sharp
 
Os Pruett Sessionnotes
Os Pruett SessionnotesOs Pruett Sessionnotes
Os Pruett Sessionnotes
 
Os Keyshacks
Os KeyshacksOs Keyshacks
Os Keyshacks
 
Os Buncetutorial
Os BuncetutorialOs Buncetutorial
Os Buncetutorial
 
Os Napier
Os NapierOs Napier
Os Napier
 
Os Treat
Os TreatOs Treat
Os Treat
 
Os Raible
Os RaibleOs Raible
Os Raible
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
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
 
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
 
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
 
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
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Último (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
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
 
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...
 
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
 
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
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Yuicss R7

  • 1. If you can’t read this, move closer Making the hard stuff fun & easy with YUI CSS Vani Raja vani@webchic.net http://webchic.net/talks/yui/ OSCON ’07 r7
  • 2. YUI CSS: Why It Rocks ★ A handful of predefined styles that will rock your world. ★ Over 750 page layout possibilities in under 3 minutes – minimal html changes! ★ A-Grade browser support (supported and tested by Yahoo) ★ Normalize all HTML elements to ensure similar display across browsers. ★ Customized table-less page layouts in 10 minutes, without two Advil.
  • 3. Basic CSS terminology ★ div – html element Essential building block of your layout. ★ id – selector One unique per page. Like your driver’s license. #header, <div id=”header”></div> ★ class –selector Up to many per page. .caption, <span class=”caption”></span> http://flickr.com/photos/randomlyhumming/247604167/
  • 4. The Files ★normalizes margins, padding, etc. reset.css ★sets font baseline & even scaling fonts.css ★defines classes for preset height grids.css and widths of div html elements
  • 5. reset.css body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h 6,pre,form,fieldset,input,textarea,p,blockq uote,th,td {margin:0;padding:0;} table {border-collapse:collapse;border- spacing:0;} fieldset,img {border:0;} address,caption,cite,code,dfn,em,strong,th, var {font-style:normal;font-weight:normal;} ol,ul {list-style:none;}caption,th {text- align:left;} h1,h2,h3,h4,h5,h6 {font-size: 100%;font-weight:normal;} q:before,q:after {content:'';}abbr,acronym {border:0;}
  • 6. what reset does ★ starts with everything normalized, zeroed and borderless ★ margin & padding: 0 body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,field set,input,textarea,p,blockquote,th,td ★ border: 0 fieldset,img,abbr
  • 7. fonts.css body {font:13px arial,helvetica,clean,sans- serif;*font-size:small;*font:x-small;} table {font-size:inherit;font:100%;} select, input, textarea {font:99% arial,helvetica,clean,sans-serif;} pre, code {font:115% monospace;*font-size: 100%;}body * {line-height:1.22em;} ★ handles uneven font-scaling ★ sets standard line-height across browsers
  • 8. Using YUI CSS ★ Download the latest build and use from your ~/css directory ★ Or link to files served from Yahoo! servers: <link rel=quot;stylesheetquot; type=quot;text/cssquot; href=quot;http:// yui.yahooapis.com/2.2.2/build/reset-fonts-grids/reset- fonts-grids.cssquot; /> ★ (a combined file; minimized and compressed served by Yahoo) ★ First, include YUI css files. Either download, or serve from Yahoo ★ Explicitly set h1, h2, p, etc. in your own master.css
  • 9. grids.css woohoo – this is the cool stuff!
  • 10. Build Your Page: doc page width IDs * doc 750px doc2 950px doc3 100% <div id=quot;docquot;> <div id=quot;hdquot;> Header </div> <div id=quot;bdquot;> Body </div> <div id=quot;ftquot;> Footer </div> </div> * border colors have been applied for clarity
  • 11. Build Your Page: template <div id=quot;docquot; class=quot;yui-t1quot;> template classes <div id=quot;hdquot;> Header </div> .yui-t1 160px on left <div id=quot;bdquot;> <div id=quot;yui-mainquot;> .yui-t2 180px on left <div class=quot;yui-bquot;> Main </div> .yui-t3 300px on left </div> .yui-t4 180px on right <div class=quot;yui-bquot;> Side </div> </div> .yui-t5 240px on right <div id=quot;ftquot;> Footer </div> .yui-t6 300px on right </div> One full-width .yui-t7 column (“yui-b” = “yui block”)
  • 12. Build Your Page: template presets .yui-t2 - 180px on left .yui-t3 - 300px on left .yui-t4 - 180px on right .yui-t5 - 240px on right
  • 13. Build Your Page: grids ★ Instant two- to four-column sections ★ Safe nesting ★ Source order independent <div class=quot;yui-gquot;> <div class=quot;yui-u firstquot;></div> <div class=quot;yui-uquot;></div> </div>
  • 14. Cascading Style Sheets Abstract and re-use! http://flickr.com/photos/cayusa/477619516/
  • 15. Cascade for Simple Folk ★ Last style applied takes effect! ★ Doesn’t matter if in single/multiple files. ★ Set all colors in one file, fonts in another file, etc.
  • 16. The Cascade <link rel=”stylesheet” src=”master.css” ...> <link rel=”stylesheet” src=”winter.css” ...> /* master.css */ ★ Use to override previous .tagline { styles color: #ccc; } ★ Create custom themes for users, seasons, accessibility /* winter.css */ ★ Separation of concerns: .tagline { color: #aaa; layout.css vs. winter.css }
  • 17. A Sense of Style ★ Use semantic names as much as possible #logo, .tagline, .thumbnail, #profile_gallery ★ Keep the non-semantic names to a bare minimum if used at all .black_line, #left_whitespace ★ Indentation & comments. (Can be stripped later.)
  • 18. Use “standards mode” <!DOCTYPE HTML PUBLIC quot;-//W3C//DTD HTML 4.01//ENquot; quot;http://www.w3.org/TR/html4/strict.dtdquot;> Yeah, so it takes a little more attention to detail, but... ★ Trigger a more consistent HTML interpretation across browsers ★ Accessibility-friendly ★ Don’t be MySpace
  • 19. Top 5 FAQ in under 5 minutes!
  • 20. How do floats work? img.thumbnail { float: left; } ★ Don’t “align” - float! ★ Like a rock in a stream, other elements FLOAT around it. ★ To make the next element CLEAR the bottom of your floated item, clear it. div#gallery { clear: left; }
  • 21. Float Your Cares Away Or, the benefits of using float. ★ Mimic table layouts without the table! ★ Specific per-column do that!) & padding margins (Bet your tables can’t ★ Progressive downloading in floated column layouts. ★ For the skinny, check out Max Design’s Floatutorial. http://css.maxdesign.com.au/floatutorial/
  • 22. What about positioning? position: absolute; ★ “Where does this element go in relation to its PARENT?” div#absolute { /* parent is body */ position: absolute; top: 40px; left: 40px; } ★ Removed from regular document flow.
  • 23. More positioning... position: relative; ★ “Where does this element go in relation to its MARKUP?” div#relative_box { position: relative; top: 40px; left: 40px; } ★ Previous place held occupied!
  • 24. Mixing relative and absolute positioning ★ To absolutely position something inside an element, set the wrapping element to position: relative. ★ For more on positioning, peek at BarelyFitz Designs’ Learn CSS Positioning in Ten Steps.
  • 25. Inline divs? Block span? ★ All elements display as either block or by default. inline ★ They can also be forced to do the opposite! ★ Give a span a height and width by adding display: block ★ K.I.S.S. - Ask yourself if there’s a better markup element to use instead! h1#subheader { display: inline; = text-align: left; <span></span> font: 10px Ar... }
  • 26. So, what about tables? ★ Leave tables for large amounts of tabular data. ★ Learn a solid table-replacement CSS technique. div.thumbnail { float: left; <div class=”thumbnail”>!</div> width: 100px; <div class=”thumbnail”>!</div> height: 100px; <div class=”thumbnail”>!</div> margin: 0 20px 20px 0; <div class=”thumbnail”>!</div> }
  • 27. Stuff I’d Recommend :-) ★ YUI CSS Cheatsheet! http://yuiblog.com/assets/pdf/cheatsheets/css.pdf ★ TextMate, Transmit, CSSEdit, Coda, Free Ruler, DigitalColor Meter (OS X) ★ CSSViewer, Firebug (Firefox), Opera 9/Mini ★ Dolor Sit Amet (OSX/Dashboard) ★ Web Developer’s Handbook http://www.alvit.de/handbook/
  • 28. Thank you! • Slides http://webchic.net/talks/yui • Yahoo Grids http://developer.yahoo.com/yui/grids/ • See it in action! http://www.yellowbot.com http://www.webchic.net • More questions? Need help? vani@webchic.net