SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
Adding Style with CSS
                             The first steps to making your page look fab




Thursday, October 14, 2010
Before we start

                     • Install Firefox and Web Developer Toolbar
                     • Open http://doglr.com/base-css.html
                     • We will edit the CSS directly via WDT and
                             save the changes to /css/start-css.css




Thursday, October 14, 2010
What is CSS?
                     • Cascading Style Sheets
                     • The styles cascade. Generic rules are over
                             powered by more specific rules.
                     • The closer you get to the tag, the more
                             powerful the rule
                     • HTML provides structure, CSS provides
                             style


Thursday, October 14, 2010
CSS syntax

                     • selector {property:value; property:value;}
                     • selector selector {property:value;}
                     • selector.class {property:value}
                     • selector#id {property:value}

Thursday, October 14, 2010
The most basic rule

                     • * {color:black}
                     • * = everything
                     • color:black = make text black


Thursday, October 14, 2010
Style a container
                     • The uppermost container: html
                      • html {background: #000000; }
                      • #000000 = hexadecimal code for black
                      • #000 = #000000
                     • A specific container
                      • html body aside p {color:pink;}
Thursday, October 14, 2010
Id and Class
                     • An id can only be used once on a page.
                     • A class can be used multiple times
                     • Keep the names functional, not stylistic, i.e.
                             class=”intro” not class=”bigletter”
                     • header#hd = the header with id=”hd”
                     • p.first = the paragraph with class=”first”
Thursday, October 14, 2010
Popular CSS properties
                     • border: 1px solid red;
                     • margin: 10px 0 5px 10px; /* top, right,
                             bottom, left */
                     • background-color: yellow;
                     • width:500px;
                     • display:block;

Thursday, October 14, 2010
Fonts
                             Style for your text




Thursday, October 14, 2010
What is an em?
                     • The size of the letter m
                     • A proportional size, that allows the user to
                             resize the text.
                     • A better measurement for fonts and
                             container widths.
                     •

Thursday, October 14, 2010
What is a px?

                     • A single pixel.
                     • Proportional to the size of the screen.
                     • Good for objects that don’t resize, such as
                             images




Thursday, October 14, 2010
What is a pt?
                     • A point.
                     • Something used for printing on paper, not
                             the web.
                     • Often times you’ll see this for web display
                             and it’s not a good idea.
                     • 1px does not equal 1pt.

Thursday, October 14, 2010
Font Families

                     • Serifs have feet and tails. These are good
                             for reading paragraphs and large bodies of
                             text. They are mostly used on paper.

                     • Sans Serifs do not have feet and tails. These
                             are good for the web.

                     • Don’t use comic sans!

Thursday, October 14, 2010
Popular Font Rules
                     • font-family: woot, helvetica, arial, sans-serif;
                      • The browser will use the first font your
                             computer has available.
                     • font-size: 1.1 em;
                     • color: #808080;
                     • text-decoration:none;
Thursday, October 14, 2010
Layout Styles
                             Create grids and text flows




Thursday, October 14, 2010
Positioning
                             relative - absolute - fixed




Thursday, October 14, 2010
Position
                     • Position:relative; The object remains in the
                             content flow. This is a basic status, but is
                             not a default.
                     • Position:absolute; Position the item
                             absolutely to it’s closest relatively
                             positioned parent.
                     • Position:fixed; object is positioned
                             absolutely, but doesn’t move as the user
                             scrolls.
Thursday, October 14, 2010
Floating
                             Powerful grids and content flow




Thursday, October 14, 2010
Floats

                     • Float:left; /* or right */
                      • The object will move as far to one side as
                             it can. It stops when it hits something
                             solid.
                     • Clear:left /* or right, both */
                      • The object will drop below anything
                             previously floated

Thursday, October 14, 2010
Text Flow
                     • Text and other elements will flow around
                             an object that has been floated.
                     • This gives you the floated image effect.
                                      This text will
                                      flow around
                                the floated box.


Thursday, October 14, 2010
Next Class

                     • Why you should hate Internet Explorer
                     • How to use libraries
                     • Background images
                     • Intro to CSS3, pseudo-selectors, attribute
                             selectors...



Thursday, October 14, 2010
Resources

                     • http://csszengarden.com
                     • Subscribe to http://www.css-discuss.org/
                     • http://css.maxdesign.com.au/
                     • http://www.last-child.com/category/css/

Thursday, October 14, 2010

Contenu connexe

Similaire à Beginning css

Syracuse symposium11-17-2010
Syracuse symposium11-17-2010Syracuse symposium11-17-2010
Syracuse symposium11-17-2010
Niki Brown
 
Vancouver WordPress Meetup - WordPress 101
Vancouver WordPress Meetup - WordPress 101Vancouver WordPress Meetup - WordPress 101
Vancouver WordPress Meetup - WordPress 101
designfaire
 
HTML5 impact on application programming
HTML5 impact on application programmingHTML5 impact on application programming
HTML5 impact on application programming
Ericsson Labs
 

Similaire à Beginning css (15)

Syracuse symposium11-17-2010
Syracuse symposium11-17-2010Syracuse symposium11-17-2010
Syracuse symposium11-17-2010
 
Improving Site Design and Usability
Improving Site Design and UsabilityImproving Site Design and Usability
Improving Site Design and Usability
 
Vancouver WordPress Meetup - WordPress 101
Vancouver WordPress Meetup - WordPress 101Vancouver WordPress Meetup - WordPress 101
Vancouver WordPress Meetup - WordPress 101
 
Managing in an XML environment
Managing in an XML environmentManaging in an XML environment
Managing in an XML environment
 
Building Distributed JavaScript Widgets with jQuery
Building Distributed JavaScript Widgets with jQueryBuilding Distributed JavaScript Widgets with jQuery
Building Distributed JavaScript Widgets with jQuery
 
Collaboration over competition
Collaboration over competitionCollaboration over competition
Collaboration over competition
 
Basic Doc Design
Basic Doc DesignBasic Doc Design
Basic Doc Design
 
Open Standards in the Walled Garden
Open Standards in the Walled GardenOpen Standards in the Walled Garden
Open Standards in the Walled Garden
 
The Reluctant SysAdmin : 360|iDev Austin 2010
The Reluctant SysAdmin : 360|iDev Austin 2010The Reluctant SysAdmin : 360|iDev Austin 2010
The Reluctant SysAdmin : 360|iDev Austin 2010
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDB
 
Debugging your JavaScript
Debugging your JavaScriptDebugging your JavaScript
Debugging your JavaScript
 
Games Design 2 - Lecture 5 - Text
Games Design 2 - Lecture 5 - TextGames Design 2 - Lecture 5 - Text
Games Design 2 - Lecture 5 - Text
 
Plone Conference 2010 – Where we go from here
Plone Conference 2010 – Where we go from herePlone Conference 2010 – Where we go from here
Plone Conference 2010 – Where we go from here
 
Web Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To ComplexWeb Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To Complex
 
HTML5 impact on application programming
HTML5 impact on application programmingHTML5 impact on application programming
HTML5 impact on application programming
 

Plus de Ted Drake

Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024
Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024
Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024
Ted Drake
 
Transforming Accessibility one lunch at a tiime - CSUN 2023
Transforming Accessibility one lunch at a tiime - CSUN 2023Transforming Accessibility one lunch at a tiime - CSUN 2023
Transforming Accessibility one lunch at a tiime - CSUN 2023
Ted Drake
 
The Saga of Accessible Colors
The Saga of Accessible ColorsThe Saga of Accessible Colors
The Saga of Accessible Colors
Ted Drake
 

Plus de Ted Drake (20)

Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024
Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024
Introduce Trauma-Informed Design to Your Organization - CSUN ATC 2024
 
Transforming Accessibility one lunch at a tiime - CSUN 2023
Transforming Accessibility one lunch at a tiime - CSUN 2023Transforming Accessibility one lunch at a tiime - CSUN 2023
Transforming Accessibility one lunch at a tiime - CSUN 2023
 
Inclusive Design for cognitive disabilities, neurodiversity, and chronic illness
Inclusive Design for cognitive disabilities, neurodiversity, and chronic illnessInclusive Design for cognitive disabilities, neurodiversity, and chronic illness
Inclusive Design for cognitive disabilities, neurodiversity, and chronic illness
 
Inclusive design for Long Covid
 Inclusive design for Long Covid  Inclusive design for Long Covid
Inclusive design for Long Covid
 
Covid 19, brain fog, and inclusive design
Covid 19, brain fog, and inclusive designCovid 19, brain fog, and inclusive design
Covid 19, brain fog, and inclusive design
 
Customer obsession and accessibility
Customer obsession and accessibilityCustomer obsession and accessibility
Customer obsession and accessibility
 
The Saga of Accessible Colors
The Saga of Accessible ColorsThe Saga of Accessible Colors
The Saga of Accessible Colors
 
Artificial Intelligence and Accessibility - GAAD 2020 - Hello A11y
Artificial Intelligence and Accessibility - GAAD 2020 - Hello A11yArtificial Intelligence and Accessibility - GAAD 2020 - Hello A11y
Artificial Intelligence and Accessibility - GAAD 2020 - Hello A11y
 
Expand your outreach with an accessibility champions program
Expand your outreach with an accessibility champions program Expand your outreach with an accessibility champions program
Expand your outreach with an accessibility champions program
 
Intuit's Accessibility Champion Program - Coaching and Celebrating
Intuit's Accessibility Champion Program - Coaching and Celebrating Intuit's Accessibility Champion Program - Coaching and Celebrating
Intuit's Accessibility Champion Program - Coaching and Celebrating
 
Accessibility First Innovation
Accessibility First InnovationAccessibility First Innovation
Accessibility First Innovation
 
Inclusive customer interviews make it your friday task
Inclusive customer interviews  make it your friday taskInclusive customer interviews  make it your friday task
Inclusive customer interviews make it your friday task
 
Coaching and Celebrating Accessibility Champions
Coaching and Celebrating Accessibility ChampionsCoaching and Celebrating Accessibility Champions
Coaching and Celebrating Accessibility Champions
 
Accessibility statements and resource publishing best practices csun 2019
Accessibility statements and resource publishing best practices   csun 2019Accessibility statements and resource publishing best practices   csun 2019
Accessibility statements and resource publishing best practices csun 2019
 
Raising Accessibility Awareness at Intuit
Raising Accessibility Awareness at IntuitRaising Accessibility Awareness at Intuit
Raising Accessibility Awareness at Intuit
 
Trickle Down Accessibility
Trickle Down AccessibilityTrickle Down Accessibility
Trickle Down Accessibility
 
Trickle-Down Accessibility - CSUN 2018
Trickle-Down Accessibility - CSUN 2018Trickle-Down Accessibility - CSUN 2018
Trickle-Down Accessibility - CSUN 2018
 
Accessibility metrics Accessibility Data Metrics and Reporting – Industry Bes...
Accessibility metrics Accessibility Data Metrics and Reporting – Industry Bes...Accessibility metrics Accessibility Data Metrics and Reporting – Industry Bes...
Accessibility metrics Accessibility Data Metrics and Reporting – Industry Bes...
 
Mystery Meat 2.0 – Making hidden mobile interactions accessible
Mystery Meat 2.0 – Making hidden mobile interactions accessibleMystery Meat 2.0 – Making hidden mobile interactions accessible
Mystery Meat 2.0 – Making hidden mobile interactions accessible
 
React Native Accessibility - San Diego React and React Native Meetup
React Native Accessibility - San Diego React and React Native MeetupReact Native Accessibility - San Diego React and React Native Meetup
React Native Accessibility - San Diego React and React Native Meetup
 

Dernier

Dernier (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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...
 
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...
 
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
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

Beginning css

  • 1. Adding Style with CSS The first steps to making your page look fab Thursday, October 14, 2010
  • 2. Before we start • Install Firefox and Web Developer Toolbar • Open http://doglr.com/base-css.html • We will edit the CSS directly via WDT and save the changes to /css/start-css.css Thursday, October 14, 2010
  • 3. What is CSS? • Cascading Style Sheets • The styles cascade. Generic rules are over powered by more specific rules. • The closer you get to the tag, the more powerful the rule • HTML provides structure, CSS provides style Thursday, October 14, 2010
  • 4. CSS syntax • selector {property:value; property:value;} • selector selector {property:value;} • selector.class {property:value} • selector#id {property:value} Thursday, October 14, 2010
  • 5. The most basic rule • * {color:black} • * = everything • color:black = make text black Thursday, October 14, 2010
  • 6. Style a container • The uppermost container: html • html {background: #000000; } • #000000 = hexadecimal code for black • #000 = #000000 • A specific container • html body aside p {color:pink;} Thursday, October 14, 2010
  • 7. Id and Class • An id can only be used once on a page. • A class can be used multiple times • Keep the names functional, not stylistic, i.e. class=”intro” not class=”bigletter” • header#hd = the header with id=”hd” • p.first = the paragraph with class=”first” Thursday, October 14, 2010
  • 8. Popular CSS properties • border: 1px solid red; • margin: 10px 0 5px 10px; /* top, right, bottom, left */ • background-color: yellow; • width:500px; • display:block; Thursday, October 14, 2010
  • 9. Fonts Style for your text Thursday, October 14, 2010
  • 10. What is an em? • The size of the letter m • A proportional size, that allows the user to resize the text. • A better measurement for fonts and container widths. • Thursday, October 14, 2010
  • 11. What is a px? • A single pixel. • Proportional to the size of the screen. • Good for objects that don’t resize, such as images Thursday, October 14, 2010
  • 12. What is a pt? • A point. • Something used for printing on paper, not the web. • Often times you’ll see this for web display and it’s not a good idea. • 1px does not equal 1pt. Thursday, October 14, 2010
  • 13. Font Families • Serifs have feet and tails. These are good for reading paragraphs and large bodies of text. They are mostly used on paper. • Sans Serifs do not have feet and tails. These are good for the web. • Don’t use comic sans! Thursday, October 14, 2010
  • 14. Popular Font Rules • font-family: woot, helvetica, arial, sans-serif; • The browser will use the first font your computer has available. • font-size: 1.1 em; • color: #808080; • text-decoration:none; Thursday, October 14, 2010
  • 15. Layout Styles Create grids and text flows Thursday, October 14, 2010
  • 16. Positioning relative - absolute - fixed Thursday, October 14, 2010
  • 17. Position • Position:relative; The object remains in the content flow. This is a basic status, but is not a default. • Position:absolute; Position the item absolutely to it’s closest relatively positioned parent. • Position:fixed; object is positioned absolutely, but doesn’t move as the user scrolls. Thursday, October 14, 2010
  • 18. Floating Powerful grids and content flow Thursday, October 14, 2010
  • 19. Floats • Float:left; /* or right */ • The object will move as far to one side as it can. It stops when it hits something solid. • Clear:left /* or right, both */ • The object will drop below anything previously floated Thursday, October 14, 2010
  • 20. Text Flow • Text and other elements will flow around an object that has been floated. • This gives you the floated image effect. This text will flow around the floated box. Thursday, October 14, 2010
  • 21. Next Class • Why you should hate Internet Explorer • How to use libraries • Background images • Intro to CSS3, pseudo-selectors, attribute selectors... Thursday, October 14, 2010
  • 22. Resources • http://csszengarden.com • Subscribe to http://www.css-discuss.org/ • http://css.maxdesign.com.au/ • http://www.last-child.com/category/css/ Thursday, October 14, 2010