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
Ad

More Related Content

What's hot (20)

Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSS
Sanjoy Kr. Paul
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
Andolasoft Inc
 
6 Steps to Make Your CSS Code More Maintainable
6 Steps to Make Your CSS Code More Maintainable6 Steps to Make Your CSS Code More Maintainable
6 Steps to Make Your CSS Code More Maintainable
10Clouds
 
Web Development Workshop (Front End)
Web Development Workshop (Front End)Web Development Workshop (Front End)
Web Development Workshop (Front End)
DSCIIITLucknow
 
HTML and CSS
HTML and CSSHTML and CSS
HTML and CSS
Ketan Ghumatkar
 
Css intro
Css introCss intro
Css intro
Andz Bass
 
Css external style sheet
Css external style sheetCss external style sheet
Css external style sheet
Jesus Obenita Jr.
 
Css introduction
Css   introductionCss   introduction
Css introduction
AbhishekMondal42
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
ShreyaShetty92
 
Style Your Site Part 1
Style Your Site Part 1Style Your Site Part 1
Style Your Site Part 1
Ben MacNeill
 
Css inclusion
Css   inclusionCss   inclusion
Css inclusion
AbhishekMondal42
 
HTML CSS and Web Development
HTML CSS and Web DevelopmentHTML CSS and Web Development
HTML CSS and Web Development
Rahul Mishra
 
Web1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSSWeb1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSS
NYCSS Meetup
 
Lesson 110 24 aug13-1400-ay
Lesson 110 24 aug13-1400-ayLesson 110 24 aug13-1400-ay
Lesson 110 24 aug13-1400-ay
Codecademy Ren
 
Dreamweaver
DreamweaverDreamweaver
Dreamweaver
chowders
 
Web Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros DeveloperWeb Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros Developer
Nyros Technologies
 
Rakshat bhati
Rakshat bhatiRakshat bhati
Rakshat bhati
Rakshat bhati
 
Upstate CSCI 450 WebDev Chapter 3
Upstate CSCI 450 WebDev Chapter 3Upstate CSCI 450 WebDev Chapter 3
Upstate CSCI 450 WebDev Chapter 3
DanWooster1
 
Css Architecture
Css ArchitectureCss Architecture
Css Architecture
pelletized
 
Session 2 intro to Css
Session 2 intro to CssSession 2 intro to Css
Session 2 intro to Css
Muhammad Hesham
 
Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSS
Sanjoy Kr. Paul
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
Andolasoft Inc
 
6 Steps to Make Your CSS Code More Maintainable
6 Steps to Make Your CSS Code More Maintainable6 Steps to Make Your CSS Code More Maintainable
6 Steps to Make Your CSS Code More Maintainable
10Clouds
 
Web Development Workshop (Front End)
Web Development Workshop (Front End)Web Development Workshop (Front End)
Web Development Workshop (Front End)
DSCIIITLucknow
 
Style Your Site Part 1
Style Your Site Part 1Style Your Site Part 1
Style Your Site Part 1
Ben MacNeill
 
HTML CSS and Web Development
HTML CSS and Web DevelopmentHTML CSS and Web Development
HTML CSS and Web Development
Rahul Mishra
 
Web1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSSWeb1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSS
NYCSS Meetup
 
Lesson 110 24 aug13-1400-ay
Lesson 110 24 aug13-1400-ayLesson 110 24 aug13-1400-ay
Lesson 110 24 aug13-1400-ay
Codecademy Ren
 
Dreamweaver
DreamweaverDreamweaver
Dreamweaver
chowders
 
Web Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros DeveloperWeb Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros Developer
Nyros Technologies
 
Upstate CSCI 450 WebDev Chapter 3
Upstate CSCI 450 WebDev Chapter 3Upstate CSCI 450 WebDev Chapter 3
Upstate CSCI 450 WebDev Chapter 3
DanWooster1
 
Css Architecture
Css ArchitectureCss Architecture
Css Architecture
pelletized
 

Viewers also liked (8)

Lecture 8 Video
Lecture 8 VideoLecture 8 Video
Lecture 8 Video
Sur College of Applied Sciences
 
Navigation1 A
Navigation1 ANavigation1 A
Navigation1 A
Sur College of Applied Sciences
 
Lecture2 CSS 3
Lecture2   CSS 3Lecture2   CSS 3
Lecture2 CSS 3
Sur College of Applied Sciences
 
Lecture 5 XML
Lecture 5  XMLLecture 5  XML
Lecture 5 XML
Sur College of Applied Sciences
 
Lecture 9 Usability Orignal
Lecture 9 Usability OrignalLecture 9 Usability Orignal
Lecture 9 Usability Orignal
Sur College of Applied Sciences
 
Lecture11 A Image
Lecture11 A ImageLecture11 A Image
Lecture11 A Image
Sur College of Applied Sciences
 
Lecture 10 Image Format
Lecture 10  Image FormatLecture 10  Image Format
Lecture 10 Image Format
Sur College of Applied Sciences
 
Lecture 11 B Security
Lecture 11 B SecurityLecture 11 B Security
Lecture 11 B Security
Sur College of Applied Sciences
 
Ad

Similar to Lecture2 CSS1 (20)

Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8
RohanMistry15
 
The CSS Handbook
The CSS HandbookThe CSS Handbook
The CSS Handbook
jackchenvlo
 
Css
CssCss
Css
zayhard99
 
New Css style
New Css styleNew Css style
New Css style
BUDNET
 
Css
CssCss
Css
mohamed ashraf
 
This is css which compiled by alex that is impo
This is css which compiled by alex that is impoThis is css which compiled by alex that is impo
This is css which compiled by alex that is impo
AlebelAyalneh
 
HTML5 and CSS Fundamentals MOOC Course College Presentation
HTML5 and CSS Fundamentals MOOC Course College PresentationHTML5 and CSS Fundamentals MOOC Course College Presentation
HTML5 and CSS Fundamentals MOOC Course College Presentation
KuchBhi90
 
Css
CssCss
Css
NIRMAL FELIX
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
butest
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
butest
 
Teched Inetrgation ppt and lering in simple
Teched Inetrgation ppt  and lering in simpleTeched Inetrgation ppt  and lering in simple
Teched Inetrgation ppt and lering in simple
JagadishBabuParri
 
Advance Css 1194323118268797 5
Advance Css 1194323118268797 5Advance Css 1194323118268797 5
Advance Css 1194323118268797 5
dharshyamal
 
Advance Css
Advance CssAdvance Css
Advance Css
vijayta
 
DHTML
DHTMLDHTML
DHTML
Ravinder Kamboj
 
ITEC229_Chapter8_new.ppt computer architecture
ITEC229_Chapter8_new.ppt computer architectureITEC229_Chapter8_new.ppt computer architecture
ITEC229_Chapter8_new.ppt computer architecture
compengwaelalahmar
 
Css home
Css   homeCss   home
Css home
AbhishekMondal42
 
CSS
CSSCSS
CSS
BG Java EE Course
 
Chapter 3 - CSS.pdf
Chapter 3 - CSS.pdfChapter 3 - CSS.pdf
Chapter 3 - CSS.pdf
wubiederebe1
 
Vskills certified css designer Notes
Vskills certified css designer NotesVskills certified css designer Notes
Vskills certified css designer Notes
Vskills
 
Web technologies part-2
Web technologies part-2Web technologies part-2
Web technologies part-2
Michael Anthony
 
Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8Advanced Web Programming Chapter 8
Advanced Web Programming Chapter 8
RohanMistry15
 
The CSS Handbook
The CSS HandbookThe CSS Handbook
The CSS Handbook
jackchenvlo
 
New Css style
New Css styleNew Css style
New Css style
BUDNET
 
This is css which compiled by alex that is impo
This is css which compiled by alex that is impoThis is css which compiled by alex that is impo
This is css which compiled by alex that is impo
AlebelAyalneh
 
HTML5 and CSS Fundamentals MOOC Course College Presentation
HTML5 and CSS Fundamentals MOOC Course College PresentationHTML5 and CSS Fundamentals MOOC Course College Presentation
HTML5 and CSS Fundamentals MOOC Course College Presentation
KuchBhi90
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
butest
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
butest
 
Teched Inetrgation ppt and lering in simple
Teched Inetrgation ppt  and lering in simpleTeched Inetrgation ppt  and lering in simple
Teched Inetrgation ppt and lering in simple
JagadishBabuParri
 
Advance Css 1194323118268797 5
Advance Css 1194323118268797 5Advance Css 1194323118268797 5
Advance Css 1194323118268797 5
dharshyamal
 
Advance Css
Advance CssAdvance Css
Advance Css
vijayta
 
ITEC229_Chapter8_new.ppt computer architecture
ITEC229_Chapter8_new.ppt computer architectureITEC229_Chapter8_new.ppt computer architecture
ITEC229_Chapter8_new.ppt computer architecture
compengwaelalahmar
 
Chapter 3 - CSS.pdf
Chapter 3 - CSS.pdfChapter 3 - CSS.pdf
Chapter 3 - CSS.pdf
wubiederebe1
 
Vskills certified css designer Notes
Vskills certified css designer NotesVskills certified css designer Notes
Vskills certified css designer Notes
Vskills
 
Ad

More from Sur College of Applied Sciences (7)

Lecture 9 Professional Practices
Lecture 9 Professional PracticesLecture 9 Professional Practices
Lecture 9 Professional Practices
Sur College of Applied Sciences
 
Lecture 9 Accessibility Original
Lecture 9 Accessibility OriginalLecture 9 Accessibility Original
Lecture 9 Accessibility Original
Sur College of Applied Sciences
 
Accessibility Usability Professional Summry
Accessibility Usability Professional SummryAccessibility Usability Professional Summry
Accessibility Usability Professional Summry
Sur College of Applied Sciences
 
Lecture 6 Data Driven Design
Lecture 6  Data Driven DesignLecture 6  Data Driven Design
Lecture 6 Data Driven Design
Sur College of Applied Sciences
 
Lecture2 CSS 2
Lecture2  CSS 2Lecture2  CSS 2
Lecture2 CSS 2
Sur College of Applied Sciences
 
Lecture1 B Frames&Forms
Lecture1 B  Frames&FormsLecture1 B  Frames&Forms
Lecture1 B Frames&Forms
Sur College of Applied Sciences
 
Lecture 3 Javascript1
Lecture 3  Javascript1Lecture 3  Javascript1
Lecture 3 Javascript1
Sur College of Applied Sciences
 

Recently uploaded (20)

Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 

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.