SlideShare a Scribd company logo
1 of 12
(Fast) Introduction to CSS Dave Kelly ( @davkell  ) for @091Labs (Part II)
css box model Think of all HTML elements as boxes when thinking about design / layout Example 1 (for Part 2): http://www.ambientage.com/blog/091labs/ http://www.w3.org/TR/CSS2/box.html
css box model - display Some elements can be Block level (e.g. h1, p, ul, div…..) Inline level (e.g. a, strong, em, span….) CSS display property can change these ul li{display: inline }/*Changes li to display inline */ Control Full listing of display properties, support & examples: http://www.quirksmode.org/css/display.html
css positioning Boxes can be positioned in 3 ways Normal Flow 	 How we have positioned things until now Absolute Positioning  a box is removed from the normal flow entirely and assigned a position with respect to a containing block  Floats  a box is first laid out according to the normal flow, then taken out of the flow and shifted to the left or right as far as possible. Content may flow along the side of a float
element positioning The position property has 4 possible values: p { position: static } It’s a normal box laid out according to the normal flow, i.e. it behaves in the same way as all elements we’ve seen until now p { position: relative; top: 100px; left: 100px } Position calculated according to normal flow. Box is offset relative to its normal position When using relative positioning, the space left by the element’s block remains open – as if the element was positioned there.
element positioning p { position: fixed; top: 100px; left: 100px; } Causes the element to remain in a fixed position in the view port, i.e. it will not move when the document is scrolled. ( * IE6) p { position: absolute;   top: 100px; left: 150px;  } The box's position (and possibly size) is specified with the 'top', 'right', 'bottom', and 'left' properties  Boxes are taken out of the normal flow and positioned relative to the viewport this means the space where they would have appeared is not left open See ugly positioning example
element positioning: float *  When elements are floated they float to the specified margin (left or right). For example: #sidebar { float: right;} It will be floated to the right margin, and other elements will wrap around it. Valid values for this property are:  left | right | none# In layouts, using {clear: both; } will help. Lots.
some layout schemes Liquid (uses % widths) Elastic (elements use em measures => relative to text size) Fixed width, centered * (e.g. content 960px wide) Overview & some samples: http://www.smashingmagazine.com/2009/06/02/fixed-vs-fluid-vs-elastic-layout-whats-the-right-one-for-you/
what are you doing? A grid is your friend http://960.gs  See examples…
some css resources List of some best practices  http://net.tutsplus.com/tutorials/html-css-techniques/30-css-best-practices-for-beginners/ CSS Reset http://meyerweb.com/eric/tools/css/reset/index.html Some layout articles http://www.alistapart.com/topics/design/layout/(take a look at all A List Apart articles, not intro level, but well worth a read) Good front-end dev web articles generally http://24ways.org/(archives) W3C Specs…. http://www.w3.org/TR/CSS21/
moral of the story… Plan your layouts before you start Standards are your friend. Stick to them. ,[object Object]
Learn with xHTML Strict. (Will help you in the long run)

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

(Fast) Intro to HTML & CSS (Part 2)

  • 1. (Fast) Introduction to CSS Dave Kelly ( @davkell ) for @091Labs (Part II)
  • 2. css box model Think of all HTML elements as boxes when thinking about design / layout Example 1 (for Part 2): http://www.ambientage.com/blog/091labs/ http://www.w3.org/TR/CSS2/box.html
  • 3. css box model - display Some elements can be Block level (e.g. h1, p, ul, div…..) Inline level (e.g. a, strong, em, span….) CSS display property can change these ul li{display: inline }/*Changes li to display inline */ Control Full listing of display properties, support & examples: http://www.quirksmode.org/css/display.html
  • 4. css positioning Boxes can be positioned in 3 ways Normal Flow How we have positioned things until now Absolute Positioning a box is removed from the normal flow entirely and assigned a position with respect to a containing block Floats a box is first laid out according to the normal flow, then taken out of the flow and shifted to the left or right as far as possible. Content may flow along the side of a float
  • 5. element positioning The position property has 4 possible values: p { position: static } It’s a normal box laid out according to the normal flow, i.e. it behaves in the same way as all elements we’ve seen until now p { position: relative; top: 100px; left: 100px } Position calculated according to normal flow. Box is offset relative to its normal position When using relative positioning, the space left by the element’s block remains open – as if the element was positioned there.
  • 6. element positioning p { position: fixed; top: 100px; left: 100px; } Causes the element to remain in a fixed position in the view port, i.e. it will not move when the document is scrolled. ( * IE6) p { position: absolute; top: 100px; left: 150px; } The box's position (and possibly size) is specified with the 'top', 'right', 'bottom', and 'left' properties Boxes are taken out of the normal flow and positioned relative to the viewport this means the space where they would have appeared is not left open See ugly positioning example
  • 7. element positioning: float * When elements are floated they float to the specified margin (left or right). For example: #sidebar { float: right;} It will be floated to the right margin, and other elements will wrap around it. Valid values for this property are: left | right | none# In layouts, using {clear: both; } will help. Lots.
  • 8. some layout schemes Liquid (uses % widths) Elastic (elements use em measures => relative to text size) Fixed width, centered * (e.g. content 960px wide) Overview & some samples: http://www.smashingmagazine.com/2009/06/02/fixed-vs-fluid-vs-elastic-layout-whats-the-right-one-for-you/
  • 9. what are you doing? A grid is your friend http://960.gs See examples…
  • 10. some css resources List of some best practices http://net.tutsplus.com/tutorials/html-css-techniques/30-css-best-practices-for-beginners/ CSS Reset http://meyerweb.com/eric/tools/css/reset/index.html Some layout articles http://www.alistapart.com/topics/design/layout/(take a look at all A List Apart articles, not intro level, but well worth a read) Good front-end dev web articles generally http://24ways.org/(archives) W3C Specs…. http://www.w3.org/TR/CSS21/
  • 11.
  • 12. Learn with xHTML Strict. (Will help you in the long run)
  • 13.