SlideShare a Scribd company logo
Cascading Style Sheets (CSS)  An Introduction Chris Poteet www.siolon.com
Definition Cascading Style Sheets (CSS) form the presentation layer of the user interface. Structure (XHTML) Behavior (Client-Side Scripting) Presentation (CSS) Tells the browser agent  how  the element is to be presented to the user.
Why CSS? CSS removes the presentation attributes from the structure allowing reusability, ease of maintainability, and an interchangeable presentation layer. HTML was never meant to be a presentation language.  Proprietary vendors have created tags to add presentation to structure. <font> <b> <i> CSS allows us to make global and instantaneous changes easily.
The Cascade The power of CSS is found in the “cascade” which is the combination of the browser’s default styles, external style sheets, embedded, inline, and even user-defined styles. The cascade sets priorities on the individual styles which effects inheritance.
CSS Inheritance Allows elements to “inherit” styles from parent elements. Helpful in reducing the amount of CSS to set styles for child elements. Unless a more specific style is set on a child element, the element looks to the parent element for its styles. Each style has a numeric specificity value that is given based on its selector.
Using Style Sheets External Style Sheet <link href=“stylesheet” type=“text/css” href=“location.css” /> Also a “media” descriptor (screen, tv, print, handheld, etc) Preferred method. Embedded Styles <style type=“text/css”> body {} </style> Inline Styles <p style=“font-size: 12px”>Lorem ipsum</p>
CSS Syntax selector/element { property: value; } The selector can either be a grouping of elements, an indentifier, class, or single XHTML element (body, div, etc)
Type (Element) Selector Specify the style(s) for a single XHTML element. body { margin: 0; padding: 0; border-top: 1px solid #ff0; }
Grouping Elements Allows you to specify a single style for multiple elements at one time. h1, h2, h3, h4, h5, h6 { font-family: “Trebuchet MS”, sans-serif; }
The Class Selector <p class=“intro”>This is my introduction text</p> .intro { font: 12px verdana, sans-serif; margin: 10px; }
The Identifier Selector <p id=“intro”> This is my introduction text</p> #intro { border-bottom: 2px dashed #fff; }
CSS Selectors Identifier or class?  What’s the difference? An identifier is specified only once on a page and has a higher inheritance specificity than a class. A class is reusable as many times as needed in a page. Use identifiers for main sections and sub-sections of your document.
Advanced CSS Selectors Descendant Selector body h1 { } #navigation p {} Adjacent Sibling Selectors p.intro + span {} Child Selectors div ol > p {} Universal Selector * {} Attribute Selectors div[href=“http://home.org”] Pseudo-Class Selectors a:active {} #nav:hover {}
The Box Model Every element in the DOM (Document Object Model) has a conceptual “box” for presentation. The box consists of margin, padding, border, content (width, height), and offset (top, left)
CSS and Semantic Web CSS aids in increasing the semantic value of the web content. Increasing the semantic value of content aids in accessibility, and it is integral in the move away from (X)HTML to XML driven applications. An example would be using an unordered list for navigation instead of a table. Navigation is truly a “list” of information and not tabular data.
CSS Browser Acceptance The advent of modern browsers (IE 5.5+, Firefox 1.5+, Safari 2+, Opera) has eliminated the fear of effectively utilizing CSS. There remain certain selectors and attributes that vary in browser acceptance, but IE7, FF 2, Safari 3 all accept the CSS 2.1 specification. There no longer remains any excuse not to utilize CSS in your application.
CSS Fonts Font-family Font-weight Font-style Font-size
CSS Units & Colors Units % in cm mm em px  pt Colors color name (red, etc) rgb(x,x,x) #rrggbb (HEX)
CSS Layout Margin Padding Border Z-index Positioning Width Height Float Text-align Vertical-align
CSS vs Table Layouts Tables are designed only for tabular data and not for layout. Reduces semantic value of markup Makes updating difficult and impractical CSS allows positioning that reduces overall markup size, form, and allows layout to be changed by only editing a stylesheet. CSS layouts also improve accessibility, because screen readers turn off style sheets allowing only the content to remain.
CSS Text Text-indent Text-align Text-decoration Letter-spacing Text-transform Word-spacing White-space
CSS Background Background-color Background-image Background-position Background-repeat
CSS Lists List-style List-style-image List-style-position List-style-type
CSS Shorthand Consolidates many styles into a single declaration. font-family: verdana, sans-serif; font-weight: bold; font-size: 12px;    font: bold 12px verdana, sans-serif; padding-top: 5px; padding-right: 8px; padding-bottom: 5px; padding-left: 10px;    padding: 5px 8px 5px 10px;
CSS and Accessibility Section 508 Standards “ Web pages shall be designed so that all information conveyed with color is also available without color, for example from context or markup.” (1194.22C) “ A text-only page, with equivalent information or functionality, shall be provided to make a web site comply with the provisions of this part, when compliance cannot be accomplished in any other way. The content of the text-only page shall be updated whenever the primary page changes.” (1194.22K) By moving all presentation into style sheets and removing tables from layout the content is presented in an optimal manner to screen readers and other accessibility tools. CSS 2.1 has “aural” properties that can be applied to content.
CSS Resources CSS2 Reference  CSS Units  CSS Colors  Tableless Forms  Preparing your CSS for Internet Explorer 7  CSS Tinderbox (CSS Layouts)  Approx Conversion From pts to px  CSS 2 Cheat Sheet  CSS Shorthand Guide
Questions?

More Related Content

What's hot (20)

CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
Amit Kumar Singh
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
Evolution Network
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
Salman Memon
 
Css Ppt
Css PptCss Ppt
Css Ppt
Hema Prasanth
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
abhilashagupta
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
apnwebdev
 
Css
CssCss
Css
Hemant Saini
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Mario Hernandez
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Folasade Adedeji
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
Amit Tyagi
 
css.ppt
css.pptcss.ppt
css.ppt
bhasula
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Ferdous Mahmud Shaon
 
Css selectors
Css selectorsCss selectors
Css selectors
Parth Trivedi
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
Varun C M
 
Intro to HTML & CSS
Intro to HTML & CSSIntro to HTML & CSS
Intro to HTML & CSS
Syed Sami
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
Shawn Calvert
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
Fahim Abdullah
 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
fantasticdigitaltools
 
Css box-model
Css box-modelCss box-model
Css box-model
Webtech Learning
 
Css lecture notes
Css lecture notesCss lecture notes
Css lecture notes
Santhiya Grace
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
Salman Memon
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
abhilashagupta
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
apnwebdev
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Mario Hernandez
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
Amit Tyagi
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
Varun C M
 
Intro to HTML & CSS
Intro to HTML & CSSIntro to HTML & CSS
Intro to HTML & CSS
Syed Sami
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
Shawn Calvert
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
Fahim Abdullah
 

Similar to Introduction to Cascading Style Sheets (CSS) (20)

2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
VarunMM2
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
VarunMM2
 
CSS Overview
CSS OverviewCSS Overview
CSS Overview
Doncho Minkov
 
Css
CssCss
Css
actacademy
 
Css
CssCss
Css
actacademy
 
Css
CssCss
Css
NIRMAL FELIX
 
lec11_CSS.pptx web page description desi
lec11_CSS.pptx web page description desilec11_CSS.pptx web page description desi
lec11_CSS.pptx web page description desi
compengwaelalahmar
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1
Heather Rock
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
Singsys Pte Ltd
 
DW_lesson2 ntro_HTML_CSS_preso ntro_HTML_CSS_preso.ppt
DW_lesson2 ntro_HTML_CSS_preso ntro_HTML_CSS_preso.pptDW_lesson2 ntro_HTML_CSS_preso ntro_HTML_CSS_preso.ppt
DW_lesson2 ntro_HTML_CSS_preso ntro_HTML_CSS_preso.ppt
YazanMohamed1
 
Rational HATS and CSS
Rational HATS and CSSRational HATS and CSS
Rational HATS and CSS
Strongback Consulting
 
DW_lesson2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.ppt
DW_lesson2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.pptDW_lesson2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.ppt
DW_lesson2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.ppt
MaryRoseEyao
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
JohnpaulStem11
 
CSS Cascading Style Sheet Introduction slides
CSS Cascading Style Sheet Introduction slidesCSS Cascading Style Sheet Introduction slides
CSS Cascading Style Sheet Introduction slides
Aasma13
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
PramenathA
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
UsamaShakeel22
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
ssuser666f98
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
JohnSon872476
 
Intro webtechstc
Intro webtechstcIntro webtechstc
Intro webtechstc
cmcsubho
 
Css training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentialsCss training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentials
QA TrainingHub
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
VarunMM2
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
VarunMM2
 
lec11_CSS.pptx web page description desi
lec11_CSS.pptx web page description desilec11_CSS.pptx web page description desi
lec11_CSS.pptx web page description desi
compengwaelalahmar
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1
Heather Rock
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
Singsys Pte Ltd
 
DW_lesson2 ntro_HTML_CSS_preso ntro_HTML_CSS_preso.ppt
DW_lesson2 ntro_HTML_CSS_preso ntro_HTML_CSS_preso.pptDW_lesson2 ntro_HTML_CSS_preso ntro_HTML_CSS_preso.ppt
DW_lesson2 ntro_HTML_CSS_preso ntro_HTML_CSS_preso.ppt
YazanMohamed1
 
DW_lesson2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.ppt
DW_lesson2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.pptDW_lesson2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.ppt
DW_lesson2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.ppt
MaryRoseEyao
 
CSS Cascading Style Sheet Introduction slides
CSS Cascading Style Sheet Introduction slidesCSS Cascading Style Sheet Introduction slides
CSS Cascading Style Sheet Introduction slides
Aasma13
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
PramenathA
 
Intro webtechstc
Intro webtechstcIntro webtechstc
Intro webtechstc
cmcsubho
 
Css training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentialsCss training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentials
QA TrainingHub
 

More from Chris Poteet (8)

Venn Consulting Project
Venn Consulting ProjectVenn Consulting Project
Venn Consulting Project
Chris Poteet
 
SharePoint and Usability Testing
SharePoint and Usability TestingSharePoint and Usability Testing
SharePoint and Usability Testing
Chris Poteet
 
WordPress In The Enterprise
WordPress In The EnterpriseWordPress In The Enterprise
WordPress In The Enterprise
Chris Poteet
 
Web Standards In An ASP.NET World
Web Standards In An ASP.NET WorldWeb Standards In An ASP.NET World
Web Standards In An ASP.NET World
Chris Poteet
 
User Experience
User ExperienceUser Experience
User Experience
Chris Poteet
 
User Interface Design For Programmers
User Interface Design For ProgrammersUser Interface Design For Programmers
User Interface Design For Programmers
Chris Poteet
 
HTML 5 vs. XHTML 2: The Future of Web Standards
HTML 5 vs. XHTML 2: The Future of Web StandardsHTML 5 vs. XHTML 2: The Future of Web Standards
HTML 5 vs. XHTML 2: The Future of Web Standards
Chris Poteet
 
The Value-Up Paradigm
The Value-Up ParadigmThe Value-Up Paradigm
The Value-Up Paradigm
Chris Poteet
 
Venn Consulting Project
Venn Consulting ProjectVenn Consulting Project
Venn Consulting Project
Chris Poteet
 
SharePoint and Usability Testing
SharePoint and Usability TestingSharePoint and Usability Testing
SharePoint and Usability Testing
Chris Poteet
 
WordPress In The Enterprise
WordPress In The EnterpriseWordPress In The Enterprise
WordPress In The Enterprise
Chris Poteet
 
Web Standards In An ASP.NET World
Web Standards In An ASP.NET WorldWeb Standards In An ASP.NET World
Web Standards In An ASP.NET World
Chris Poteet
 
User Interface Design For Programmers
User Interface Design For ProgrammersUser Interface Design For Programmers
User Interface Design For Programmers
Chris Poteet
 
HTML 5 vs. XHTML 2: The Future of Web Standards
HTML 5 vs. XHTML 2: The Future of Web StandardsHTML 5 vs. XHTML 2: The Future of Web Standards
HTML 5 vs. XHTML 2: The Future of Web Standards
Chris Poteet
 
The Value-Up Paradigm
The Value-Up ParadigmThe Value-Up Paradigm
The Value-Up Paradigm
Chris Poteet
 

Recently uploaded (20)

Junior Indaba June 2025. Is the new US administration good for junior mining?
Junior Indaba June 2025. Is the new US administration good for junior mining?Junior Indaba June 2025. Is the new US administration good for junior mining?
Junior Indaba June 2025. Is the new US administration good for junior mining?
James AH Campbell
 
GLASS COMMUNITIES SSE ADDENDUM All Versions.pdf
GLASS COMMUNITIES SSE ADDENDUM All Versions.pdfGLASS COMMUNITIES SSE ADDENDUM All Versions.pdf
GLASS COMMUNITIES SSE ADDENDUM All Versions.pdf
Brij Consulting, LLC
 
Module 2 - Diagnosing MSME Needs in Strategic Field Support for Sustainable M...
Module 2 - Diagnosing MSME Needs in Strategic Field Support for Sustainable M...Module 2 - Diagnosing MSME Needs in Strategic Field Support for Sustainable M...
Module 2 - Diagnosing MSME Needs in Strategic Field Support for Sustainable M...
winstonjeria
 
Paul Turovsky - Wealth Of Knowledge And Expertise
Paul Turovsky - Wealth Of Knowledge And ExpertisePaul Turovsky - Wealth Of Knowledge And Expertise
Paul Turovsky - Wealth Of Knowledge And Expertise
Paul Turovsky
 
Potassium Acetate Manufacturing Plant Project Report by Procurement Resource
Potassium Acetate Manufacturing Plant Project Report by Procurement ResourcePotassium Acetate Manufacturing Plant Project Report by Procurement Resource
Potassium Acetate Manufacturing Plant Project Report by Procurement Resource
Procurment Resource
 
Module 5 - Facilitating Market Connections.pptx
Module 5 - Facilitating Market Connections.pptxModule 5 - Facilitating Market Connections.pptx
Module 5 - Facilitating Market Connections.pptx
winstonjeria
 
Module 7 - Monitoring Progress and Sustaining Change.pptx
Module 7 - Monitoring Progress and Sustaining Change.pptxModule 7 - Monitoring Progress and Sustaining Change.pptx
Module 7 - Monitoring Progress and Sustaining Change.pptx
winstonjeria
 
Our Company Post's related ISo Certification
Our Company Post's related ISo CertificationOur Company Post's related ISo Certification
Our Company Post's related ISo Certification
ISO Certification
 
Lion One Metals Corporate Presentation - May 2025
Lion One Metals Corporate Presentation - May 2025Lion One Metals Corporate Presentation - May 2025
Lion One Metals Corporate Presentation - May 2025
Adnet Communications
 
Module 3 - Designing Tailored Support Plans.pptx
Module 3 - Designing Tailored Support Plans.pptxModule 3 - Designing Tailored Support Plans.pptx
Module 3 - Designing Tailored Support Plans.pptx
winstonjeria
 
Nternational banking serice and the future of bankin
Nternational banking serice and the future of bankinNternational banking serice and the future of bankin
Nternational banking serice and the future of bankin
taminhthu2736
 
Conference 2 Notes for Car and Home Show.pdf
Conference 2 Notes for Car and Home Show.pdfConference 2 Notes for Car and Home Show.pdf
Conference 2 Notes for Car and Home Show.pdf
Brij Consulting, LLC
 
Beyond Budgeting Conference London 21-22 May 2025.pdf
Beyond Budgeting Conference London 21-22 May 2025.pdfBeyond Budgeting Conference London 21-22 May 2025.pdf
Beyond Budgeting Conference London 21-22 May 2025.pdf
Orderly Disruption
 
Prakash Hinduja – Chairman & Managing Director, Jaihind Projects Limited
Prakash Hinduja – Chairman & Managing Director, Jaihind Projects LimitedPrakash Hinduja – Chairman & Managing Director, Jaihind Projects Limited
Prakash Hinduja – Chairman & Managing Director, Jaihind Projects Limited
deepakahujamumbai01
 
1911 Gold Corporate Presentation May 2025
1911 Gold Corporate Presentation May 20251911 Gold Corporate Presentation May 2025
1911 Gold Corporate Presentation May 2025
Shaun Heinrichs
 
How to Make Your First $1K with Ethical Affiliate Marketing
How to Make Your First $1K with Ethical Affiliate MarketingHow to Make Your First $1K with Ethical Affiliate Marketing
How to Make Your First $1K with Ethical Affiliate Marketing
Zam Man
 
Module 1 -Understanding the MSME Landscape.pptx
Module 1 -Understanding the MSME Landscape.pptxModule 1 -Understanding the MSME Landscape.pptx
Module 1 -Understanding the MSME Landscape.pptx
benstud93
 
The Mo You Know Heads to LA for the 2025 BET Experience
The Mo You Know Heads to LA for the 2025 BET ExperienceThe Mo You Know Heads to LA for the 2025 BET Experience
The Mo You Know Heads to LA for the 2025 BET Experience
PRnews2
 
Market Dynamics Sample Report - Redacted
Market Dynamics Sample Report - RedactedMarket Dynamics Sample Report - Redacted
Market Dynamics Sample Report - Redacted
Mintel Group
 
Patrick Dwyer Merrill Lynch - Support Charitable Organizations
Patrick Dwyer Merrill Lynch - Support Charitable OrganizationsPatrick Dwyer Merrill Lynch - Support Charitable Organizations
Patrick Dwyer Merrill Lynch - Support Charitable Organizations
Patrick Dwyer Merrill Lynch
 
Junior Indaba June 2025. Is the new US administration good for junior mining?
Junior Indaba June 2025. Is the new US administration good for junior mining?Junior Indaba June 2025. Is the new US administration good for junior mining?
Junior Indaba June 2025. Is the new US administration good for junior mining?
James AH Campbell
 
GLASS COMMUNITIES SSE ADDENDUM All Versions.pdf
GLASS COMMUNITIES SSE ADDENDUM All Versions.pdfGLASS COMMUNITIES SSE ADDENDUM All Versions.pdf
GLASS COMMUNITIES SSE ADDENDUM All Versions.pdf
Brij Consulting, LLC
 
Module 2 - Diagnosing MSME Needs in Strategic Field Support for Sustainable M...
Module 2 - Diagnosing MSME Needs in Strategic Field Support for Sustainable M...Module 2 - Diagnosing MSME Needs in Strategic Field Support for Sustainable M...
Module 2 - Diagnosing MSME Needs in Strategic Field Support for Sustainable M...
winstonjeria
 
Paul Turovsky - Wealth Of Knowledge And Expertise
Paul Turovsky - Wealth Of Knowledge And ExpertisePaul Turovsky - Wealth Of Knowledge And Expertise
Paul Turovsky - Wealth Of Knowledge And Expertise
Paul Turovsky
 
Potassium Acetate Manufacturing Plant Project Report by Procurement Resource
Potassium Acetate Manufacturing Plant Project Report by Procurement ResourcePotassium Acetate Manufacturing Plant Project Report by Procurement Resource
Potassium Acetate Manufacturing Plant Project Report by Procurement Resource
Procurment Resource
 
Module 5 - Facilitating Market Connections.pptx
Module 5 - Facilitating Market Connections.pptxModule 5 - Facilitating Market Connections.pptx
Module 5 - Facilitating Market Connections.pptx
winstonjeria
 
Module 7 - Monitoring Progress and Sustaining Change.pptx
Module 7 - Monitoring Progress and Sustaining Change.pptxModule 7 - Monitoring Progress and Sustaining Change.pptx
Module 7 - Monitoring Progress and Sustaining Change.pptx
winstonjeria
 
Our Company Post's related ISo Certification
Our Company Post's related ISo CertificationOur Company Post's related ISo Certification
Our Company Post's related ISo Certification
ISO Certification
 
Lion One Metals Corporate Presentation - May 2025
Lion One Metals Corporate Presentation - May 2025Lion One Metals Corporate Presentation - May 2025
Lion One Metals Corporate Presentation - May 2025
Adnet Communications
 
Module 3 - Designing Tailored Support Plans.pptx
Module 3 - Designing Tailored Support Plans.pptxModule 3 - Designing Tailored Support Plans.pptx
Module 3 - Designing Tailored Support Plans.pptx
winstonjeria
 
Nternational banking serice and the future of bankin
Nternational banking serice and the future of bankinNternational banking serice and the future of bankin
Nternational banking serice and the future of bankin
taminhthu2736
 
Conference 2 Notes for Car and Home Show.pdf
Conference 2 Notes for Car and Home Show.pdfConference 2 Notes for Car and Home Show.pdf
Conference 2 Notes for Car and Home Show.pdf
Brij Consulting, LLC
 
Beyond Budgeting Conference London 21-22 May 2025.pdf
Beyond Budgeting Conference London 21-22 May 2025.pdfBeyond Budgeting Conference London 21-22 May 2025.pdf
Beyond Budgeting Conference London 21-22 May 2025.pdf
Orderly Disruption
 
Prakash Hinduja – Chairman & Managing Director, Jaihind Projects Limited
Prakash Hinduja – Chairman & Managing Director, Jaihind Projects LimitedPrakash Hinduja – Chairman & Managing Director, Jaihind Projects Limited
Prakash Hinduja – Chairman & Managing Director, Jaihind Projects Limited
deepakahujamumbai01
 
1911 Gold Corporate Presentation May 2025
1911 Gold Corporate Presentation May 20251911 Gold Corporate Presentation May 2025
1911 Gold Corporate Presentation May 2025
Shaun Heinrichs
 
How to Make Your First $1K with Ethical Affiliate Marketing
How to Make Your First $1K with Ethical Affiliate MarketingHow to Make Your First $1K with Ethical Affiliate Marketing
How to Make Your First $1K with Ethical Affiliate Marketing
Zam Man
 
Module 1 -Understanding the MSME Landscape.pptx
Module 1 -Understanding the MSME Landscape.pptxModule 1 -Understanding the MSME Landscape.pptx
Module 1 -Understanding the MSME Landscape.pptx
benstud93
 
The Mo You Know Heads to LA for the 2025 BET Experience
The Mo You Know Heads to LA for the 2025 BET ExperienceThe Mo You Know Heads to LA for the 2025 BET Experience
The Mo You Know Heads to LA for the 2025 BET Experience
PRnews2
 
Market Dynamics Sample Report - Redacted
Market Dynamics Sample Report - RedactedMarket Dynamics Sample Report - Redacted
Market Dynamics Sample Report - Redacted
Mintel Group
 
Patrick Dwyer Merrill Lynch - Support Charitable Organizations
Patrick Dwyer Merrill Lynch - Support Charitable OrganizationsPatrick Dwyer Merrill Lynch - Support Charitable Organizations
Patrick Dwyer Merrill Lynch - Support Charitable Organizations
Patrick Dwyer Merrill Lynch
 

Introduction to Cascading Style Sheets (CSS)

  • 1. Cascading Style Sheets (CSS) An Introduction Chris Poteet www.siolon.com
  • 2. Definition Cascading Style Sheets (CSS) form the presentation layer of the user interface. Structure (XHTML) Behavior (Client-Side Scripting) Presentation (CSS) Tells the browser agent how the element is to be presented to the user.
  • 3. Why CSS? CSS removes the presentation attributes from the structure allowing reusability, ease of maintainability, and an interchangeable presentation layer. HTML was never meant to be a presentation language. Proprietary vendors have created tags to add presentation to structure. <font> <b> <i> CSS allows us to make global and instantaneous changes easily.
  • 4. The Cascade The power of CSS is found in the “cascade” which is the combination of the browser’s default styles, external style sheets, embedded, inline, and even user-defined styles. The cascade sets priorities on the individual styles which effects inheritance.
  • 5. CSS Inheritance Allows elements to “inherit” styles from parent elements. Helpful in reducing the amount of CSS to set styles for child elements. Unless a more specific style is set on a child element, the element looks to the parent element for its styles. Each style has a numeric specificity value that is given based on its selector.
  • 6. Using Style Sheets External Style Sheet <link href=“stylesheet” type=“text/css” href=“location.css” /> Also a “media” descriptor (screen, tv, print, handheld, etc) Preferred method. Embedded Styles <style type=“text/css”> body {} </style> Inline Styles <p style=“font-size: 12px”>Lorem ipsum</p>
  • 7. CSS Syntax selector/element { property: value; } The selector can either be a grouping of elements, an indentifier, class, or single XHTML element (body, div, etc)
  • 8. Type (Element) Selector Specify the style(s) for a single XHTML element. body { margin: 0; padding: 0; border-top: 1px solid #ff0; }
  • 9. Grouping Elements Allows you to specify a single style for multiple elements at one time. h1, h2, h3, h4, h5, h6 { font-family: “Trebuchet MS”, sans-serif; }
  • 10. The Class Selector <p class=“intro”>This is my introduction text</p> .intro { font: 12px verdana, sans-serif; margin: 10px; }
  • 11. The Identifier Selector <p id=“intro”> This is my introduction text</p> #intro { border-bottom: 2px dashed #fff; }
  • 12. CSS Selectors Identifier or class? What’s the difference? An identifier is specified only once on a page and has a higher inheritance specificity than a class. A class is reusable as many times as needed in a page. Use identifiers for main sections and sub-sections of your document.
  • 13. Advanced CSS Selectors Descendant Selector body h1 { } #navigation p {} Adjacent Sibling Selectors p.intro + span {} Child Selectors div ol > p {} Universal Selector * {} Attribute Selectors div[href=“http://home.org”] Pseudo-Class Selectors a:active {} #nav:hover {}
  • 14. The Box Model Every element in the DOM (Document Object Model) has a conceptual “box” for presentation. The box consists of margin, padding, border, content (width, height), and offset (top, left)
  • 15. CSS and Semantic Web CSS aids in increasing the semantic value of the web content. Increasing the semantic value of content aids in accessibility, and it is integral in the move away from (X)HTML to XML driven applications. An example would be using an unordered list for navigation instead of a table. Navigation is truly a “list” of information and not tabular data.
  • 16. CSS Browser Acceptance The advent of modern browsers (IE 5.5+, Firefox 1.5+, Safari 2+, Opera) has eliminated the fear of effectively utilizing CSS. There remain certain selectors and attributes that vary in browser acceptance, but IE7, FF 2, Safari 3 all accept the CSS 2.1 specification. There no longer remains any excuse not to utilize CSS in your application.
  • 17. CSS Fonts Font-family Font-weight Font-style Font-size
  • 18. CSS Units & Colors Units % in cm mm em px pt Colors color name (red, etc) rgb(x,x,x) #rrggbb (HEX)
  • 19. CSS Layout Margin Padding Border Z-index Positioning Width Height Float Text-align Vertical-align
  • 20. CSS vs Table Layouts Tables are designed only for tabular data and not for layout. Reduces semantic value of markup Makes updating difficult and impractical CSS allows positioning that reduces overall markup size, form, and allows layout to be changed by only editing a stylesheet. CSS layouts also improve accessibility, because screen readers turn off style sheets allowing only the content to remain.
  • 21. CSS Text Text-indent Text-align Text-decoration Letter-spacing Text-transform Word-spacing White-space
  • 22. CSS Background Background-color Background-image Background-position Background-repeat
  • 23. CSS Lists List-style List-style-image List-style-position List-style-type
  • 24. CSS Shorthand Consolidates many styles into a single declaration. font-family: verdana, sans-serif; font-weight: bold; font-size: 12px;  font: bold 12px verdana, sans-serif; padding-top: 5px; padding-right: 8px; padding-bottom: 5px; padding-left: 10px;  padding: 5px 8px 5px 10px;
  • 25. CSS and Accessibility Section 508 Standards “ Web pages shall be designed so that all information conveyed with color is also available without color, for example from context or markup.” (1194.22C) “ A text-only page, with equivalent information or functionality, shall be provided to make a web site comply with the provisions of this part, when compliance cannot be accomplished in any other way. The content of the text-only page shall be updated whenever the primary page changes.” (1194.22K) By moving all presentation into style sheets and removing tables from layout the content is presented in an optimal manner to screen readers and other accessibility tools. CSS 2.1 has “aural” properties that can be applied to content.
  • 26. CSS Resources CSS2 Reference CSS Units CSS Colors Tableless Forms Preparing your CSS for Internet Explorer 7 CSS Tinderbox (CSS Layouts) Approx Conversion From pts to px CSS 2 Cheat Sheet CSS Shorthand Guide