SlideShare a Scribd company logo
1 of 28
Download to read offline
CSS 201
 Jennifer Berk
  12/21/2009
Why CSS 201?

• It’s easy to learn the basics, but complex
  styles can be cryptic
• You never know when you’ll need to build
  something from scratch
• And everyone seemed excited when I
  mentioned the idea!
What’s CSS?

• Cascading - more specific or later
  statements can modify earlier ones
• Style - determine the presentation of
  elements on webpages
• Sheets - can be multiple files
What Did CSS Change?
Basic selectors
• One-item selector: elementname
  or .classname or #idname followed by
  { styles here }
• Two-item selector: element-a element-b
  { styles here } means use those styles for
  an element-b that is inside an element-a
• Doesn’t have to be the direct child
Basic styles

• font: italic bold 10px/15px Verdana;
• background: #ff0000 url(red-gradient.gif)
  no-repeat top left;
• margin/padding        Margin    Padding

                                 Test
• etc.
CSS 201 Agenda
• Tools
• Resets
• Advanced selectors
• Quirks mode versus standards mode
• Position and Floats
• Common browser bugs and hacks
Tools
• Firefox
 • DOM Inspector
 • Error Console (more for JavaScript)
 • Web Developer
 • Firebug
• IE Developer Toolbar
• Multiple IE
Firefox: DOM Inspector




•
    DOM = Document Object Model
     (hierarchical tree on the left)
Firefox: DOM Inspector




•
    This view shows what the current style
      actually is, not what the rules are.
Firefox: Error Console
Firefox: Web Developer
Firefox: Firebug
IE Developer Toolbar
Multiple IE
• Lets you install IE6 (and 5.5 and 5, though
  you really don’t need those anymore) on a
  system that otherwise runs IE7
• The multiples behave slightly weirdly - don’t
  expect all JavaScript/Flash to work
• Hasn’t been updated to use on a system
  running IE8
Resets
Advanced selectors
• .firstclass.secondclass = something with
  both firstclass and second class, like <div
  class=“firstclass secondclass”>
• Note #id.classname has bugs, don’t use
• firstelement>secondelement = a
  secondelement that’s a direct child of a
  firstelement (doesn’t work in IE<7)
“Quirks Mode” vs
   “Standards Mode”
• You want standards mode
• Get it by including a DOCTYPE declaration
  above the <html> tag
• You probably want <!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0
  Transitional//EN" "http://www.w3.org/TR/
  xhtml1/DTD/xhtml1-transitional.dtd">
Position property
• Static = default, part of regular flow
• Fixed = removed from flow; does not scroll
• Relative = takes up original space but can
  be moved; container for absolute position
• Absolute = removed from flow, placed
  using distance from edges (e.g. top: 10px;)
  of nearest parent with position: relative
Floats
• Can have values left, right, none; (to
  override another rule)
• Element floated left allows other content
  to flow around its right margin; vice versa
  for element floated right
• Can stack series of floated elements next
  to each other
Common bugs/hacks
• IE<7 hack: * html selectors { styles here }
• (IE<6) Box model bug
• Min-height bug
• Float double margin bug
• Float containment bug / Holly hack
• Peekaboo bug
• 3px jog bug
IE <7 hack: * html

• To target only IE6 and earlier, add * html to
  the beginning of your selector
• Very important for fixing several of the
  following bugs
• Also useful for debugging, if something is
  only broken in IE6


                    http://en.wikipedia.org/wiki/CSS_filter#Star_HTML_hack
(IE<6) Box model bug
 • Feed IE<6
      the modified
      width using
      the * html
      selector hack
 • IE6 gets it
      right in
      standards
      mode

http://www.456bereastreet.com/archive/200612/internet_explorer_and_the_css_box_model/
Min-height bug
• IE6 and earlier don’t recognize min-height
  (or min-width, max-height, max-width)
• But they treat height like min-height, so use
  the * html selector hack to give them that
  instead
Float double margin bug

• An element floated left with a left margin of
  10px has a margin of 20px in IE<7
• Same for right-floated with a right margin
• Adding display: inline; fixes it

              http://www.positioniseverything.net/explorer/doubled-margin.html
Float containment quirk


• Floats hang out of their containing
  elements in non-IE browsers
• If you want the container to surround (e.g.
  container’s background should continue to
  bottom of float), add class=“clearfix” to it
                                  http://www.positioniseverything.net/easyclearing.html
 http://www.456bereastreet.com/archive/200603/new_clearing_method_needed_for_ie7/
Peekaboo bug

• Sometimes you see your content,
  sometimes you don’t, in IE<7, of course
• Position: relative; will make the disappearing
  element be drawn last, so it will be on top
  of whatever’s intermittently hiding it



                  http://www.positioniseverything.net/explorer/peekaboo.html
3px jog bug
• Next to a float, IE<7 adds an extra 3px of
  phantom space. The extra space ends
  when the float does. So you get a sudden
  3px jog in the left edge of the paragraph
  next to the float, for instance.
• Read the link for the (fairly complicated)
  fix. When you can, avoid it by floating one
  element left and one element right and
  leaving >3px between them.

                 http://www.positioniseverything.net/explorer/threepxtest.html

More Related Content

What's hot

網頁程式設計
網頁程式設計網頁程式設計
網頁程式設計傳錡 蕭
 
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafSpring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafThymeleaf
 
The Why and What of Pattern Lab
The Why and What of Pattern LabThe Why and What of Pattern Lab
The Why and What of Pattern LabDave Olsen
 
Rapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapRapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapJosh Jeffryes
 
Modern Java web applications with Spring Boot and Thymeleaf
Modern Java web applications with Spring Boot and ThymeleafModern Java web applications with Spring Boot and Thymeleaf
Modern Java web applications with Spring Boot and ThymeleafLAY Leangsros
 
[Access U 2010] HTML5 & Accessibility
[Access U 2010] HTML5 & Accessibility[Access U 2010] HTML5 & Accessibility
[Access U 2010] HTML5 & AccessibilityChristopher Schmitt
 
Intro to Pattern Lab
Intro to Pattern LabIntro to Pattern Lab
Intro to Pattern LabPaul Stonier
 
libinjection: new technique in detecting SQLi attacks, iSEC Partners Open Forum
libinjection: new technique in detecting SQLi attacks, iSEC Partners Open Forumlibinjection: new technique in detecting SQLi attacks, iSEC Partners Open Forum
libinjection: new technique in detecting SQLi attacks, iSEC Partners Open ForumNick Galbreath
 
SQL-RISC: New Directions in SQLi Prevention - RSA USA 2013
SQL-RISC: New Directions in SQLi Prevention - RSA USA 2013SQL-RISC: New Directions in SQLi Prevention - RSA USA 2013
SQL-RISC: New Directions in SQLi Prevention - RSA USA 2013Nick Galbreath
 
Ajax search function
Ajax search functionAjax search function
Ajax search functionNorifumi Irie
 
libinjection: from SQLi to XSS  by Nick Galbreath
libinjection: from SQLi to XSS  by Nick Galbreathlibinjection: from SQLi to XSS  by Nick Galbreath
libinjection: from SQLi to XSS  by Nick GalbreathCODE BLUE
 
Leveling Up at JavaScript
Leveling Up at JavaScriptLeveling Up at JavaScript
Leveling Up at JavaScriptRaymond Camden
 
Web development basics (Part-1)
Web development basics (Part-1)Web development basics (Part-1)
Web development basics (Part-1)Rajat Pratap Singh
 
Contributing to the Community
Contributing to the CommunityContributing to the Community
Contributing to the CommunityWO Community
 
Thinking in React
Thinking in ReactThinking in React
Thinking in ReactXcat Liu
 
Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014Adrian Roselli
 
URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5jakemallory
 
Abstractions: Fringe Accessibility
Abstractions: Fringe AccessibilityAbstractions: Fringe Accessibility
Abstractions: Fringe AccessibilityAdrian Roselli
 

What's hot (20)

網頁程式設計
網頁程式設計網頁程式設計
網頁程式設計
 
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafSpring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
 
The Why and What of Pattern Lab
The Why and What of Pattern LabThe Why and What of Pattern Lab
The Why and What of Pattern Lab
 
Rapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapRapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with Bootstrap
 
Modern Java web applications with Spring Boot and Thymeleaf
Modern Java web applications with Spring Boot and ThymeleafModern Java web applications with Spring Boot and Thymeleaf
Modern Java web applications with Spring Boot and Thymeleaf
 
[Access U 2010] HTML5 & Accessibility
[Access U 2010] HTML5 & Accessibility[Access U 2010] HTML5 & Accessibility
[Access U 2010] HTML5 & Accessibility
 
Intro to Pattern Lab
Intro to Pattern LabIntro to Pattern Lab
Intro to Pattern Lab
 
libinjection: new technique in detecting SQLi attacks, iSEC Partners Open Forum
libinjection: new technique in detecting SQLi attacks, iSEC Partners Open Forumlibinjection: new technique in detecting SQLi attacks, iSEC Partners Open Forum
libinjection: new technique in detecting SQLi attacks, iSEC Partners Open Forum
 
Floating
FloatingFloating
Floating
 
SQL-RISC: New Directions in SQLi Prevention - RSA USA 2013
SQL-RISC: New Directions in SQLi Prevention - RSA USA 2013SQL-RISC: New Directions in SQLi Prevention - RSA USA 2013
SQL-RISC: New Directions in SQLi Prevention - RSA USA 2013
 
jQuery quick tips
jQuery quick tipsjQuery quick tips
jQuery quick tips
 
Ajax search function
Ajax search functionAjax search function
Ajax search function
 
libinjection: from SQLi to XSS  by Nick Galbreath
libinjection: from SQLi to XSS  by Nick Galbreathlibinjection: from SQLi to XSS  by Nick Galbreath
libinjection: from SQLi to XSS  by Nick Galbreath
 
Leveling Up at JavaScript
Leveling Up at JavaScriptLeveling Up at JavaScript
Leveling Up at JavaScript
 
Web development basics (Part-1)
Web development basics (Part-1)Web development basics (Part-1)
Web development basics (Part-1)
 
Contributing to the Community
Contributing to the CommunityContributing to the Community
Contributing to the Community
 
Thinking in React
Thinking in ReactThinking in React
Thinking in React
 
Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014
 
URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5
 
Abstractions: Fringe Accessibility
Abstractions: Fringe AccessibilityAbstractions: Fringe Accessibility
Abstractions: Fringe Accessibility
 

Viewers also liked

What I Learned on My Fall Vacation
What I Learned on My Fall VacationWhat I Learned on My Fall Vacation
What I Learned on My Fall VacationJennifer Berk
 
Social Media At Work
Social Media At WorkSocial Media At Work
Social Media At WorkJennifer Berk
 
Twitter For Nonprofits
Twitter For NonprofitsTwitter For Nonprofits
Twitter For NonprofitsJennifer Berk
 
Content Cross-promotion
Content Cross-promotionContent Cross-promotion
Content Cross-promotionJennifer Berk
 
Chicago Booth MBA application presentation (2010)
Chicago Booth MBA application presentation (2010)Chicago Booth MBA application presentation (2010)
Chicago Booth MBA application presentation (2010)Jennifer Berk
 
Introduction to SQL (for Chicago Booth MBA technology club)
Introduction to SQL (for Chicago Booth MBA technology club)Introduction to SQL (for Chicago Booth MBA technology club)
Introduction to SQL (for Chicago Booth MBA technology club)Jennifer Berk
 
Minimum Viable Project Management
Minimum Viable Project ManagementMinimum Viable Project Management
Minimum Viable Project ManagementJennifer Berk
 

Viewers also liked (7)

What I Learned on My Fall Vacation
What I Learned on My Fall VacationWhat I Learned on My Fall Vacation
What I Learned on My Fall Vacation
 
Social Media At Work
Social Media At WorkSocial Media At Work
Social Media At Work
 
Twitter For Nonprofits
Twitter For NonprofitsTwitter For Nonprofits
Twitter For Nonprofits
 
Content Cross-promotion
Content Cross-promotionContent Cross-promotion
Content Cross-promotion
 
Chicago Booth MBA application presentation (2010)
Chicago Booth MBA application presentation (2010)Chicago Booth MBA application presentation (2010)
Chicago Booth MBA application presentation (2010)
 
Introduction to SQL (for Chicago Booth MBA technology club)
Introduction to SQL (for Chicago Booth MBA technology club)Introduction to SQL (for Chicago Booth MBA technology club)
Introduction to SQL (for Chicago Booth MBA technology club)
 
Minimum Viable Project Management
Minimum Viable Project ManagementMinimum Viable Project Management
Minimum Viable Project Management
 

Similar to CSS 201

Cross Browser Issues - few solutions inspired by smashing magazine
Cross Browser Issues - few solutions inspired by smashing magazineCross Browser Issues - few solutions inspired by smashing magazine
Cross Browser Issues - few solutions inspired by smashing magazinePrabhakaran Mani
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)François Massart
 
Designing True Cross-Platform Apps
Designing True Cross-Platform AppsDesigning True Cross-Platform Apps
Designing True Cross-Platform AppsFITC
 
Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Brian Moon
 
Browser Internals for JS Devs: WebU Toronto 2016 by Alex Blom
Browser Internals for JS Devs: WebU Toronto 2016 by Alex BlomBrowser Internals for JS Devs: WebU Toronto 2016 by Alex Blom
Browser Internals for JS Devs: WebU Toronto 2016 by Alex BlomAlex Blom
 
TYPO3 Transition Tool
TYPO3 Transition ToolTYPO3 Transition Tool
TYPO3 Transition Toolcrus0e
 
Untying the Knots of Web Dev with Internet Explorer
Untying the Knots of Web Dev with Internet Explorer Untying the Knots of Web Dev with Internet Explorer
Untying the Knots of Web Dev with Internet Explorer Sarah Dutkiewicz
 
Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Derek Jacoby
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScriptkoppenolski
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Dutyreedmaniac
 
HTML, CSS, and Javascript for Web developed by hu
HTML, CSS, and Javascript for Web developed by huHTML, CSS, and Javascript for Web developed by hu
HTML, CSS, and Javascript for Web developed by huwekineheshete
 
Hacking iBooks and ePub3 with JavaScript!
Hacking iBooks and ePub3 with JavaScript!Hacking iBooks and ePub3 with JavaScript!
Hacking iBooks and ePub3 with JavaScript!Jim McKeeth
 
Intro to html5 Boilerplate
Intro to html5 BoilerplateIntro to html5 Boilerplate
Intro to html5 BoilerplateMichael Enslow
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyLeslie Doherty
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQueryGill Cleeren
 
Untangling spring week5
Untangling spring week5Untangling spring week5
Untangling spring week5Derek Jacoby
 
The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)Chris Mills
 

Similar to CSS 201 (20)

Cross Browser Issues - few solutions inspired by smashing magazine
Cross Browser Issues - few solutions inspired by smashing magazineCross Browser Issues - few solutions inspired by smashing magazine
Cross Browser Issues - few solutions inspired by smashing magazine
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)
 
Designing True Cross-Platform Apps
Designing True Cross-Platform AppsDesigning True Cross-Platform Apps
Designing True Cross-Platform Apps
 
Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3
 
Browser Internals for JS Devs: WebU Toronto 2016 by Alex Blom
Browser Internals for JS Devs: WebU Toronto 2016 by Alex BlomBrowser Internals for JS Devs: WebU Toronto 2016 by Alex Blom
Browser Internals for JS Devs: WebU Toronto 2016 by Alex Blom
 
TYPO3 Transition Tool
TYPO3 Transition ToolTYPO3 Transition Tool
TYPO3 Transition Tool
 
Untying the Knots of Web Dev with Internet Explorer
Untying the Knots of Web Dev with Internet Explorer Untying the Knots of Web Dev with Internet Explorer
Untying the Knots of Web Dev with Internet Explorer
 
Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScript
 
HTML5shim
HTML5shimHTML5shim
HTML5shim
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
HTML, CSS, and Javascript for Web developed by hu
HTML, CSS, and Javascript for Web developed by huHTML, CSS, and Javascript for Web developed by hu
HTML, CSS, and Javascript for Web developed by hu
 
Hacking iBooks and ePub3 with JavaScript!
Hacking iBooks and ePub3 with JavaScript!Hacking iBooks and ePub3 with JavaScript!
Hacking iBooks and ePub3 with JavaScript!
 
Intro to html5 Boilerplate
Intro to html5 BoilerplateIntro to html5 Boilerplate
Intro to html5 Boilerplate
 
presentation
presentationpresentation
presentation
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQuery
 
Untangling spring week5
Untangling spring week5Untangling spring week5
Untangling spring week5
 
The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)
 

Recently uploaded

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

CSS 201

  • 1. CSS 201 Jennifer Berk 12/21/2009
  • 2. Why CSS 201? • It’s easy to learn the basics, but complex styles can be cryptic • You never know when you’ll need to build something from scratch • And everyone seemed excited when I mentioned the idea!
  • 3. What’s CSS? • Cascading - more specific or later statements can modify earlier ones • Style - determine the presentation of elements on webpages • Sheets - can be multiple files
  • 4. What Did CSS Change?
  • 5. Basic selectors • One-item selector: elementname or .classname or #idname followed by { styles here } • Two-item selector: element-a element-b { styles here } means use those styles for an element-b that is inside an element-a • Doesn’t have to be the direct child
  • 6. Basic styles • font: italic bold 10px/15px Verdana; • background: #ff0000 url(red-gradient.gif) no-repeat top left; • margin/padding Margin Padding Test • etc.
  • 7. CSS 201 Agenda • Tools • Resets • Advanced selectors • Quirks mode versus standards mode • Position and Floats • Common browser bugs and hacks
  • 8. Tools • Firefox • DOM Inspector • Error Console (more for JavaScript) • Web Developer • Firebug • IE Developer Toolbar • Multiple IE
  • 9. Firefox: DOM Inspector • DOM = Document Object Model (hierarchical tree on the left)
  • 10. Firefox: DOM Inspector • This view shows what the current style actually is, not what the rules are.
  • 15. Multiple IE • Lets you install IE6 (and 5.5 and 5, though you really don’t need those anymore) on a system that otherwise runs IE7 • The multiples behave slightly weirdly - don’t expect all JavaScript/Flash to work • Hasn’t been updated to use on a system running IE8
  • 17. Advanced selectors • .firstclass.secondclass = something with both firstclass and second class, like <div class=“firstclass secondclass”> • Note #id.classname has bugs, don’t use • firstelement>secondelement = a secondelement that’s a direct child of a firstelement (doesn’t work in IE<7)
  • 18. “Quirks Mode” vs “Standards Mode” • You want standards mode • Get it by including a DOCTYPE declaration above the <html> tag • You probably want <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/ xhtml1/DTD/xhtml1-transitional.dtd">
  • 19. Position property • Static = default, part of regular flow • Fixed = removed from flow; does not scroll • Relative = takes up original space but can be moved; container for absolute position • Absolute = removed from flow, placed using distance from edges (e.g. top: 10px;) of nearest parent with position: relative
  • 20. Floats • Can have values left, right, none; (to override another rule) • Element floated left allows other content to flow around its right margin; vice versa for element floated right • Can stack series of floated elements next to each other
  • 21. Common bugs/hacks • IE<7 hack: * html selectors { styles here } • (IE<6) Box model bug • Min-height bug • Float double margin bug • Float containment bug / Holly hack • Peekaboo bug • 3px jog bug
  • 22. IE <7 hack: * html • To target only IE6 and earlier, add * html to the beginning of your selector • Very important for fixing several of the following bugs • Also useful for debugging, if something is only broken in IE6 http://en.wikipedia.org/wiki/CSS_filter#Star_HTML_hack
  • 23. (IE<6) Box model bug • Feed IE<6 the modified width using the * html selector hack • IE6 gets it right in standards mode http://www.456bereastreet.com/archive/200612/internet_explorer_and_the_css_box_model/
  • 24. Min-height bug • IE6 and earlier don’t recognize min-height (or min-width, max-height, max-width) • But they treat height like min-height, so use the * html selector hack to give them that instead
  • 25. Float double margin bug • An element floated left with a left margin of 10px has a margin of 20px in IE<7 • Same for right-floated with a right margin • Adding display: inline; fixes it http://www.positioniseverything.net/explorer/doubled-margin.html
  • 26. Float containment quirk • Floats hang out of their containing elements in non-IE browsers • If you want the container to surround (e.g. container’s background should continue to bottom of float), add class=“clearfix” to it http://www.positioniseverything.net/easyclearing.html http://www.456bereastreet.com/archive/200603/new_clearing_method_needed_for_ie7/
  • 27. Peekaboo bug • Sometimes you see your content, sometimes you don’t, in IE<7, of course • Position: relative; will make the disappearing element be drawn last, so it will be on top of whatever’s intermittently hiding it http://www.positioniseverything.net/explorer/peekaboo.html
  • 28. 3px jog bug • Next to a float, IE<7 adds an extra 3px of phantom space. The extra space ends when the float does. So you get a sudden 3px jog in the left edge of the paragraph next to the float, for instance. • Read the link for the (fairly complicated) fix. When you can, avoid it by floating one element left and one element right and leaving >3px between them. http://www.positioniseverything.net/explorer/threepxtest.html