SlideShare a Scribd company logo
Lecture 2: CSS I SFDV2001 Web Development
Cascading Style Sheets You have experienced the limitation of presentation control in transitional HTML. Now you can forget about deprecated tags and experience the highly advanced presentation control afforded by CSS. With CSS:  One file can completely control the appearance of ALL your HTML files. You have much, much greater control over appearance and behaviour of your page content. Web sites that use CSS are much easier to alter the appearance of.
Cascading Style Sheets Transitional code is, generally speaking, consistently presented by most browsers. Switching to CSS to control all your presentation means much more work to get satisfactory behavior across a range of browsers. The power of CSS means that it is a lot more complicated than transitional HTML. There are many, many new stylistic controls and a new way of thinking about elements on your page.  Your structural HTML skills need to be sound if you are to use your CSS sensibly. Writing sensible and efficient CSS code is harder than writing good HTML code.
A little background W3C completed the CSS1 specifications in 1996. IE 3, released the same year, had some CSS support. CSS2 was published in 1998. Not until 2000, when IE 5 for Mac, was released did any browser have "full" CSS1 support. No browser has full CSS2 support.  The latest versions of Safari and Opera pass the Acid2 test. Firefox and IE do not. IE currently fares worst. "I’ll go ahead and relieve the suspense by saying we will not pass this test when IE7 ships." -  Chris Wilson (IEBlog)
Getting started Step 1. doctype: <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;> When you use CSS your HTML should conform to the HTML 4.01 strict standard. Step 2. Get rid of all deprecated tags and attributes: font align bgcolor etc. Your HTML should only describe the structure of your content, it should ideally contain no formatting information.
Getting started Step 3. Add style information Internally: inline and embedded Externally: linked and imported 99% of the time linked is the best option. You may opt to have a few single-page specific styles embedded in an HTML document. Inline styles are really no better than  <font>  tags and there are very, very few good reasons for using them. Imported and embedded styles can be hidden from older browsers.
 
 
CSS Rules Cascading style sheets consist of a series of rules that determine how your HTML content will be displayed. Rules take the format: selector{ property: value; } For example: body{ background-color: #ffe89d; }
CSS Rules You add further property value pairs to an element's rule to more specifically control its appearance: body{ background-color: #ffe89d; color: #000e78; font-family: Arial, sans-serif; margin: 5%; } A style sheet consists of a series of such rules.
Cascading It's probably fairly obvious how the &quot;style sheet&quot; bit of CSS applies, but the &quot;cascading&quot; bit isn't so obvious. The cascade in CSS is how styles take precedence over other styles. Because you can have many style rules in play, to avoid conflict certain style information overrides other.
The cascade Least powerful:  Browser default settings User browser settings Linked styles * Imported styles* Embedded styles** Inline styles Author !important rules Most powerful: User !important rules * Later files take precedence over earlier ones. ** Later rules have greater weight.
The cascade You can alter the power hierarchy by using the  !important  indicator: selector{ property: value !important; } !important  beats even inline styles. Think carefully before wielding such power - you have to ensure that the style is sensible in all circumstances.
 
Ultimately the user wins Users can take away your power with one click.
Inheritance One of the things that makes CSS so efficient to use is the ability to have style rules inherited between parent and child elements. Parent Child <html> <body> <ol> <li> <ul> <li> <table> <tr> <tr> <td>
Inheritance
Inheritance Alter to suit
Inheritance Many CSS properties are automatically inherited from an element's parent.  You can explicitly set a property's value to inherit. Everything contained within you  <body>  tags is a child of the body. So, properties set for the body can be inherited by its children (like  <p>  or  <h1>  etc).
Recommended sites: CSS Zen garden: http://www.csszengarden.com/ A List Apart's CSS articles: http://www.alistapart.com/topics/code/css/ W3C's CSS Home Page: http://www.w3.org/Style/CSS/ Further reading: Cascading Style Sheets the Definitive Guide  by Eric A. Meyer CSS Cookbook  by Christopher Schmitt

More Related Content

PDF
WordCamp Atlanta 2014 - CSS For Beginners - By Michael Earley of ATL Squared ...
PDF
CSS For Backend Developers
PDF
Introduction to the Web and HTML
PPT
How to manage a big scale HTML/CSS project
PPTX
Unit iii css and javascript 1
PDF
Q and a design2 web
PPT
Techtalk
PPTX
Html and css
WordCamp Atlanta 2014 - CSS For Beginners - By Michael Earley of ATL Squared ...
CSS For Backend Developers
Introduction to the Web and HTML
How to manage a big scale HTML/CSS project
Unit iii css and javascript 1
Q and a design2 web
Techtalk
Html and css

What's hot (20)

PDF
Structuring your CSS for maintainability: rules and guile lines to write CSS
PDF
Organize Your Website With Advanced CSS Tricks
PDF
6 Steps to Make Your CSS Code More Maintainable
PDF
Web Development Workshop (Front End)
PPTX
HTML and CSS
PPTX
Css intro
PPTX
Css external style sheet
PPTX
Css introduction
PPTX
Introduction to HTML
PDF
Style Your Site Part 1
PPTX
Css inclusion
PPTX
HTML CSS and Web Development
PPTX
Web1O1 - Intro to HTML/CSS
PPTX
Lesson 110 24 aug13-1400-ay
PPT
Dreamweaver
PPT
Web Designing Bugs - Fixes By Nyros Developer
PPTX
Rakshat bhati
PPTX
Upstate CSCI 450 WebDev Chapter 3
PPTX
Css Architecture
PPSX
Session 2 intro to Css
Structuring your CSS for maintainability: rules and guile lines to write CSS
Organize Your Website With Advanced CSS Tricks
6 Steps to Make Your CSS Code More Maintainable
Web Development Workshop (Front End)
HTML and CSS
Css intro
Css external style sheet
Css introduction
Introduction to HTML
Style Your Site Part 1
Css inclusion
HTML CSS and Web Development
Web1O1 - Intro to HTML/CSS
Lesson 110 24 aug13-1400-ay
Dreamweaver
Web Designing Bugs - Fixes By Nyros Developer
Rakshat bhati
Upstate CSCI 450 WebDev Chapter 3
Css Architecture
Session 2 intro to Css
Ad

Viewers also liked (8)

PPT
Lecture 9 Usability Orignal
PPT
PPT
Lecture 10 Image Format
PPT
Lecture 11 B Security
Ad

Similar to Lecture2 CSS1 (20)

PDF
Advanced Web Programming Chapter 8
PDF
The CSS Handbook
PPT
PPT
New Css style
PPTX
This is css which compiled by alex that is impo
PPTX
HTML5 and CSS Fundamentals MOOC Course College Presentation
PPT
DOC
Intermediate Web Design.doc
DOC
Intermediate Web Design.doc
PPTX
Teched Inetrgation ppt and lering in simple
PPT
Advance Css
PPT
Advance Css 1194323118268797 5
PDF
Css Quick Syntax Reference Guide 1st Edition Mikael Olsson Auth
PPTX
PPT
ITEC229_Chapter8_new.ppt computer architecture
PPTX
PDF
Chapter 3 - CSS.pdf
PDF
Vskills certified css designer Notes
Advanced Web Programming Chapter 8
The CSS Handbook
New Css style
This is css which compiled by alex that is impo
HTML5 and CSS Fundamentals MOOC Course College Presentation
Intermediate Web Design.doc
Intermediate Web Design.doc
Teched Inetrgation ppt and lering in simple
Advance Css
Advance Css 1194323118268797 5
Css Quick Syntax Reference Guide 1st Edition Mikael Olsson Auth
ITEC229_Chapter8_new.ppt computer architecture
Chapter 3 - CSS.pdf
Vskills certified css designer Notes

More from Sur College of Applied Sciences (7)

PPT
Lecture 9 Professional Practices
PPT
Lecture 9 Accessibility Original
PPT
Accessibility Usability Professional Summry
PPT
Lecture 6 Data Driven Design
PPT
Lecture1 B Frames&Forms
PPT
Lecture 3 Javascript1
Lecture 9 Professional Practices
Lecture 9 Accessibility Original
Accessibility Usability Professional Summry
Lecture 6 Data Driven Design
Lecture1 B Frames&Forms
Lecture 3 Javascript1

Recently uploaded (20)

PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
RMMM.pdf make it easy to upload and study
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
master seminar digital applications in india
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Institutional Correction lecture only . . .
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
VCE English Exam - Section C Student Revision Booklet
Final Presentation General Medicine 03-08-2024.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Insiders guide to clinical Medicine.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
RMMM.pdf make it easy to upload and study
TR - Agricultural Crops Production NC III.pdf
human mycosis Human fungal infections are called human mycosis..pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
master seminar digital applications in india
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Institutional Correction lecture only . . .
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
FourierSeries-QuestionsWithAnswers(Part-A).pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Microbial disease of the cardiovascular and lymphatic systems
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...

Lecture2 CSS1

  • 1. Lecture 2: CSS I SFDV2001 Web Development
  • 2. Cascading Style Sheets You have experienced the limitation of presentation control in transitional HTML. Now you can forget about deprecated tags and experience the highly advanced presentation control afforded by CSS. With CSS: One file can completely control the appearance of ALL your HTML files. You have much, much greater control over appearance and behaviour of your page content. Web sites that use CSS are much easier to alter the appearance of.
  • 3. Cascading Style Sheets Transitional code is, generally speaking, consistently presented by most browsers. Switching to CSS to control all your presentation means much more work to get satisfactory behavior across a range of browsers. The power of CSS means that it is a lot more complicated than transitional HTML. There are many, many new stylistic controls and a new way of thinking about elements on your page. Your structural HTML skills need to be sound if you are to use your CSS sensibly. Writing sensible and efficient CSS code is harder than writing good HTML code.
  • 4. A little background W3C completed the CSS1 specifications in 1996. IE 3, released the same year, had some CSS support. CSS2 was published in 1998. Not until 2000, when IE 5 for Mac, was released did any browser have &quot;full&quot; CSS1 support. No browser has full CSS2 support. The latest versions of Safari and Opera pass the Acid2 test. Firefox and IE do not. IE currently fares worst. &quot;I’ll go ahead and relieve the suspense by saying we will not pass this test when IE7 ships.&quot; - Chris Wilson (IEBlog)
  • 5. Getting started Step 1. doctype: <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;> When you use CSS your HTML should conform to the HTML 4.01 strict standard. Step 2. Get rid of all deprecated tags and attributes: font align bgcolor etc. Your HTML should only describe the structure of your content, it should ideally contain no formatting information.
  • 6. Getting started Step 3. Add style information Internally: inline and embedded Externally: linked and imported 99% of the time linked is the best option. You may opt to have a few single-page specific styles embedded in an HTML document. Inline styles are really no better than <font> tags and there are very, very few good reasons for using them. Imported and embedded styles can be hidden from older browsers.
  • 7.  
  • 8.  
  • 9. CSS Rules Cascading style sheets consist of a series of rules that determine how your HTML content will be displayed. Rules take the format: selector{ property: value; } For example: body{ background-color: #ffe89d; }
  • 10. CSS Rules You add further property value pairs to an element's rule to more specifically control its appearance: body{ background-color: #ffe89d; color: #000e78; font-family: Arial, sans-serif; margin: 5%; } A style sheet consists of a series of such rules.
  • 11. Cascading It's probably fairly obvious how the &quot;style sheet&quot; bit of CSS applies, but the &quot;cascading&quot; bit isn't so obvious. The cascade in CSS is how styles take precedence over other styles. Because you can have many style rules in play, to avoid conflict certain style information overrides other.
  • 12. The cascade Least powerful: Browser default settings User browser settings Linked styles * Imported styles* Embedded styles** Inline styles Author !important rules Most powerful: User !important rules * Later files take precedence over earlier ones. ** Later rules have greater weight.
  • 13. The cascade You can alter the power hierarchy by using the !important indicator: selector{ property: value !important; } !important beats even inline styles. Think carefully before wielding such power - you have to ensure that the style is sensible in all circumstances.
  • 14.  
  • 15. Ultimately the user wins Users can take away your power with one click.
  • 16. Inheritance One of the things that makes CSS so efficient to use is the ability to have style rules inherited between parent and child elements. Parent Child <html> <body> <ol> <li> <ul> <li> <table> <tr> <tr> <td>
  • 19. Inheritance Many CSS properties are automatically inherited from an element's parent. You can explicitly set a property's value to inherit. Everything contained within you <body> tags is a child of the body. So, properties set for the body can be inherited by its children (like <p> or <h1> etc).
  • 20. Recommended sites: CSS Zen garden: http://www.csszengarden.com/ A List Apart's CSS articles: http://www.alistapart.com/topics/code/css/ W3C's CSS Home Page: http://www.w3.org/Style/CSS/ Further reading: Cascading Style Sheets the Definitive Guide by Eric A. Meyer CSS Cookbook by Christopher Schmitt

Editor's Notes

  • #3: Show CSS Zen Garden - Dave Shea (pronouned &amp;quot;shay&amp;quot;) Show CSS Zean Garden files - same HTML for all versions.
  • #5: Show web standards project site with Acid2 test. Internet Explorer 5.0 for the Macintosh, shipped in March of 2000, was the first browser to have full (better than 99 per cent) CSS1 support. Microsoft Internet Explorer , whose version 6 lacks support for about 30 percent of CSS2 properties, and, more significantly, misinterprets a significant number of important properties, such as &amp;quot;width&amp;quot;, &amp;quot;height&amp;quot;, and &amp;quot;float&amp;quot;. &amp;quot;We fully recognize that IE is behind the game today in CSS support. We’ve dug through the Acid 2 Test and analyzed IE’s problems with the test in some great detail, and we’ve made sure the bugs and features are on our list - however, there are some fairly large and difficult features to implement, and they will not all sort to the top of the stack in IE7. I believe we are doing a much better service to web developers out there in IE7 by fixing our known bang-your-head-on-the-desk bugs and usability problems first, and prioritizing the most commonly-requested features based on all the feedback we&apos;ve had.&amp;quot; - http://blogs.msdn.com/ie/archive/2005/07/29/445242.aspx
  • #8: You can use multiple linked or imported style sheets.
  • #9: You can use multiple linked or imported style sheets.
  • #14: User &amp;quot;!important&amp;quot; rules override author &amp;quot;!important&amp;quot; rules. This CSS feature improves accessibility of documents by giving users with special requirements (large fonts, color combinations, etc.) control over presentation.
  • #20: Play with inheritance code. - Show that font face inherits automatically. - Show that background color does not automatically inherit but text color does. - Show that list color is automatic, show how to force border inhertitance.