SlideShare ist ein Scribd-Unternehmen logo
1 von 19
CIS-189
   Cascading Style Sheets allow further
    separation of content from presentation
    ◦ Can speed up content creation, since not worried
      about presentation
   A single stylesheet can alter the appearance
    of multiple web pages or documents
   Different stylesheets can alter the appearance
    of a single web page or document
   Web pages can load more quickly since
    stylesheets are downloaded once and cached
    (held in memory)
   Uses rules to control how elements are
    displayed
   Made up of
    ◦ Selector – identifies where to apply the style
    ◦ Declaration – documents the style
    ◦ Semi-colon is used to separate properties

    h1{font-family:verdana;}

                          Separator
Selector
            Declaration
   Stylesheets can be in-line, part of the
    document itself
   Stylesheets can be separate files
   Stylesheets support inheritance
    ◦ Can use several stylesheets in a single document
    ◦ In-line style overrides an external rule
<style type="text/css" media="screen">
body {
   background-color: #F4FBFD ;
   font-family: verdana;
   font-size: small;
   color: navy;
}                                body and table represent elements;
table {                          .specialDates is a class
   font-family: verdana;
   font-size: small;
   cell-padding: 2px;
}
.specialDates{
   font-weight: bold;
  font-style: italic;
  }
</style>
   Reference:
<?xml-stylesheet type="text/css" href="talltales.css"?>
   CSS File:
talltales {
  background-image: url(background.gif);
  background-repeat: repeat;
}

tt {                                 talltales and tt represent elements
  display: block;
  width: 700px;
  padding: 10px;
  margin: 10px;
  border: 5px groove #353A54;
  background-color: #353A54;
}
… (continues)



                                              From Sam’s Teach Yourself XML
?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="talltales.css"?>
<!DOCTYPE talltales SYSTEM "talltales.dtd">

<talltales>
 <tt answer="a">
  <question>
    In 1994, a man had an accident while robbing a pizza restaurant in
  Akron, Ohio, that resulted in his
    arrest. What happened to him?
  </question>
  <a>He slipped on a patch of grease on the floor and knocked himself out.</a>
  <b>He backed into a police car while attempting to drive off.</b>
  <c>He choked on a breadstick that he had grabbed as he was running out.</c>
 </tt>
… (continues)


                                                 From Sam’s Teach Yourself XML
From Sam’s Teach Yourself XML
   Selectors indicate where rules should apply
Selector Type (example)

Universal (*)             Wildcard applies to all element types in
                          document
Type (body)               Apply to specific elements
Class (.specialDates)     Apply to elements with class attribute set to
                          class name
ID (#myHomework)          Apply to elements with ID attribute matching
                          the name following hash mark (#)
Descendent (body p)       Apply to elements that belong to another
                          element
Child (body > p)          Apply to elements that are direct child of
                          other element
Adjacent Sibling (p       Matches an element that is at same level but
+ ul)                     after
   Selectors can also apply to attributes
    ◦ Not fully supported across browsers
   Class selector is for XHTML
    ◦ Browser knows meaning of class attribute for HTML
   ID selector only applies to attributes using ID
    type
    ◦ Must use DTD or schema for XML file
    ◦ Browsers don’t force validation, so can’t
      consistently read ID selectors correctly
   CSS treats each element as a rectangle (box)
   Box includes
    ◦ Margin is transparent area separating rectangle
      from other elements
    ◦ Border defines the edge of the content area
    ◦ Padding separates the content from the border
   Boxes can be block or inline
    ◦ Block deals with separate value similar to
      paragraphs (<p>, <div>, <h1>)
    ◦ Inline allows content to follow (flow) other
      tags/elements (<span>, <em>)
<p>Each week prior to Thanksgiving, students will prepare a
summary of material covered in-class, online, and in the assigned
reading. <strong>Each student is expected to prepare their own
summary.</strong> Each week has a series of questions that must be
answered as part of the summary to receive full credit; the
questions are included in the weekly folder in Angel. Code
fragments should be included to illustrate concepts or practices.
Students may prepare the summary as a Word document or build a
wiki; Word documents or links to the wiki must be emailed to the
instructor by midnight on Friday to receive credit. Students will
receive 5 points for a complete summary, 3 points for an
incomplete summary, and no points for a late or missing
submission.</p>


<p></p> represents a block; <strong></strong> represents in-line.
<?xml version="1.0" encoding="utf-8"?>
<assignments>
<assignment>
  <duedate>09/27/2011</duedate>
  <name>Homework 1 - Using XML</name>
</assignment>
<assignment>
  <duedate>10/11/2011</duedate>
  <name>Homework 2 - DOM</name>
</assignment>
<assignment>
  <duedate>10/18/2011</duedate>
  <name>Homework 3 - DTD</name>
</assignment>
…
</assignments>
assignment {
       font-family: Verdana, Geneva, Tahoma, sans-serif;
       font-size: medium;
       font-weight: bold;
       display:inline;
       color: #0000FF;
}
duedate {
       background-color: #99CCFF;
}




                Each assignment immediately follows prior assignment
assignment {
       font-family: Verdana, Geneva, Tahoma, sans-serif;
       font-size: medium;
       font-weight: bold;
       display:block;
       color: #0000FF;
}
duedate {
       background-color: #99CCFF;
       display:inline;
}




                           Each assignment is on a new line (block)
   Normal flow (default) presents one element after
    another from top to bottom
    ◦ Can include relative positioning to offset a box from the
      preceding element
   Float positioning allows other content to flow
    around
    ◦ Set a width to specify how much of the containing box to
      use – otherwise will take up 100% of the space
   Absolute positioning specifies a fixed location to
    place content
    ◦ Set the top and left properties
    ◦ Fixed can be used to make position about the browser
      window
assignments {
          background-color: #C0C0C0;
          border: medium groove #0000FF;
          margin: 0px;                            Creates border around contents
          padding: 10px;                          and sets background (applies to
          display: block;                         root element)
}
assignment {
          margin: 5px;
          font-family: Verdana, Geneva, Tahoma, sans-serif;
          font-size: medium;
          font-weight: bold;
          display: block;
          color: #0000FF;
}
duedate {
          background-color: #CCCCFF;
          display: inline;
          float: right;
}




                                        Due date comes after name (float)
   Tabular data can be displayed using float
    positioning or using display settings
    ◦ Float positioning is shown in In-line v. Block: Block
   Display settings include
    ◦ table;
    ◦ table-row;
    ◦ table-cell;
assignment {
         display: table-row;
}
name {
         display:table-cell;
         font-style:italic;
         padding:10px;
}
duedate {
         display: table-cell;
         font-weight:bold;
         padding:10px;
}
assignments {
         padding: 10px;
         display: table;
}

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Xml basics
Xml basicsXml basics
Xml basics
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
 
Unit iv xml
Unit iv xmlUnit iv xml
Unit iv xml
 
XML Document Object Model (DOM)
XML Document Object Model (DOM)XML Document Object Model (DOM)
XML Document Object Model (DOM)
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Understanding XML DOM
Understanding XML DOMUnderstanding XML DOM
Understanding XML DOM
 
FFW Gabrovo PMG - JavaScript 1
FFW Gabrovo PMG - JavaScript 1FFW Gabrovo PMG - JavaScript 1
FFW Gabrovo PMG - JavaScript 1
 
FFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQueryFFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQuery
 
FFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTMLFFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTML
 
Cmsc 100 xhtml and css
Cmsc 100 xhtml and cssCmsc 100 xhtml and css
Cmsc 100 xhtml and css
 
XSD
XSDXSD
XSD
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 
Js datatypes
Js datatypesJs datatypes
Js datatypes
 
Xml schema
Xml schemaXml schema
Xml schema
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
 
03 namespace
03 namespace03 namespace
03 namespace
 
Unit iv xml dom
Unit iv xml domUnit iv xml dom
Unit iv xml dom
 
fundamentals of XML
fundamentals of XMLfundamentals of XML
fundamentals of XML
 
DOM and SAX
DOM and SAXDOM and SAX
DOM and SAX
 

Ähnlich wie CSS

Web app development_html_css_03
Web app development_html_css_03Web app development_html_css_03
Web app development_html_css_03
Hassen Poreya
 

Ähnlich wie CSS (20)

CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
Unit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.pptUnit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.ppt
 
Basic css
Basic cssBasic css
Basic css
 
Webpage style with CSS
Webpage style with CSSWebpage style with CSS
Webpage style with CSS
 
Css
CssCss
Css
 
Web app development_html_css_03
Web app development_html_css_03Web app development_html_css_03
Web app development_html_css_03
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
CSS: The Boring Bits
CSS: The Boring BitsCSS: The Boring Bits
CSS: The Boring Bits
 
CSS HTML.pdf
CSS HTML.pdfCSS HTML.pdf
CSS HTML.pdf
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSS
 
Html advance
Html advanceHtml advance
Html advance
 
HTML-Advance.pptx
HTML-Advance.pptxHTML-Advance.pptx
HTML-Advance.pptx
 
Intro to html, css & sass
Intro to html, css & sassIntro to html, css & sass
Intro to html, css & sass
 
Css
CssCss
Css
 
Css
CssCss
Css
 
KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7
 
CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 

Mehr von Randy Riness @ South Puget Sound Community College

Mehr von Randy Riness @ South Puget Sound Community College (20)

Stored procedures
Stored proceduresStored procedures
Stored procedures
 
3 sql overview
3 sql overview3 sql overview
3 sql overview
 
Normalization
NormalizationNormalization
Normalization
 
CIS160 final review
CIS160 final reviewCIS160 final review
CIS160 final review
 
SQL Constraints
SQL ConstraintsSQL Constraints
SQL Constraints
 
CIS 245 Final Review
CIS 245 Final ReviewCIS 245 Final Review
CIS 245 Final Review
 
CIS145 Final Review
CIS145 Final ReviewCIS145 Final Review
CIS145 Final Review
 
Cis166 Final Review C#
Cis166 Final Review C#Cis166 Final Review C#
Cis166 Final Review C#
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 
CIS245 sql
CIS245 sqlCIS245 sql
CIS245 sql
 
Cis245 Midterm Review
Cis245 Midterm ReviewCis245 Midterm Review
Cis245 Midterm Review
 
XPath
XPathXPath
XPath
 
XSLT Overview
XSLT OverviewXSLT Overview
XSLT Overview
 
Views
ViewsViews
Views
 
CIS282 Midterm review
CIS282 Midterm reviewCIS282 Midterm review
CIS282 Midterm review
 
Schemas 2 - Restricting Values
Schemas 2 - Restricting ValuesSchemas 2 - Restricting Values
Schemas 2 - Restricting Values
 
CIS 145 test 1 review
CIS 145 test 1 reviewCIS 145 test 1 review
CIS 145 test 1 review
 
XML schemas
XML schemasXML schemas
XML schemas
 
Document type definitions part 2
Document type definitions part 2Document type definitions part 2
Document type definitions part 2
 
Document type definitions part 1
Document type definitions part 1Document type definitions part 1
Document type definitions part 1
 

Kürzlich hochgeladen

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Kürzlich hochgeladen (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

CSS

  • 2. Cascading Style Sheets allow further separation of content from presentation ◦ Can speed up content creation, since not worried about presentation  A single stylesheet can alter the appearance of multiple web pages or documents  Different stylesheets can alter the appearance of a single web page or document  Web pages can load more quickly since stylesheets are downloaded once and cached (held in memory)
  • 3. Uses rules to control how elements are displayed  Made up of ◦ Selector – identifies where to apply the style ◦ Declaration – documents the style ◦ Semi-colon is used to separate properties h1{font-family:verdana;} Separator Selector Declaration
  • 4. Stylesheets can be in-line, part of the document itself  Stylesheets can be separate files  Stylesheets support inheritance ◦ Can use several stylesheets in a single document ◦ In-line style overrides an external rule
  • 5. <style type="text/css" media="screen"> body { background-color: #F4FBFD ; font-family: verdana; font-size: small; color: navy; } body and table represent elements; table { .specialDates is a class font-family: verdana; font-size: small; cell-padding: 2px; } .specialDates{ font-weight: bold; font-style: italic; } </style>
  • 6. Reference: <?xml-stylesheet type="text/css" href="talltales.css"?>  CSS File: talltales { background-image: url(background.gif); background-repeat: repeat; } tt { talltales and tt represent elements display: block; width: 700px; padding: 10px; margin: 10px; border: 5px groove #353A54; background-color: #353A54; } … (continues) From Sam’s Teach Yourself XML
  • 7. ?xml version="1.0"?> <?xml-stylesheet type="text/css" href="talltales.css"?> <!DOCTYPE talltales SYSTEM "talltales.dtd"> <talltales> <tt answer="a"> <question> In 1994, a man had an accident while robbing a pizza restaurant in Akron, Ohio, that resulted in his arrest. What happened to him? </question> <a>He slipped on a patch of grease on the floor and knocked himself out.</a> <b>He backed into a police car while attempting to drive off.</b> <c>He choked on a breadstick that he had grabbed as he was running out.</c> </tt> … (continues) From Sam’s Teach Yourself XML
  • 8. From Sam’s Teach Yourself XML
  • 9. Selectors indicate where rules should apply Selector Type (example) Universal (*) Wildcard applies to all element types in document Type (body) Apply to specific elements Class (.specialDates) Apply to elements with class attribute set to class name ID (#myHomework) Apply to elements with ID attribute matching the name following hash mark (#) Descendent (body p) Apply to elements that belong to another element Child (body > p) Apply to elements that are direct child of other element Adjacent Sibling (p Matches an element that is at same level but + ul) after
  • 10. Selectors can also apply to attributes ◦ Not fully supported across browsers  Class selector is for XHTML ◦ Browser knows meaning of class attribute for HTML  ID selector only applies to attributes using ID type ◦ Must use DTD or schema for XML file ◦ Browsers don’t force validation, so can’t consistently read ID selectors correctly
  • 11. CSS treats each element as a rectangle (box)  Box includes ◦ Margin is transparent area separating rectangle from other elements ◦ Border defines the edge of the content area ◦ Padding separates the content from the border  Boxes can be block or inline ◦ Block deals with separate value similar to paragraphs (<p>, <div>, <h1>) ◦ Inline allows content to follow (flow) other tags/elements (<span>, <em>)
  • 12. <p>Each week prior to Thanksgiving, students will prepare a summary of material covered in-class, online, and in the assigned reading. <strong>Each student is expected to prepare their own summary.</strong> Each week has a series of questions that must be answered as part of the summary to receive full credit; the questions are included in the weekly folder in Angel. Code fragments should be included to illustrate concepts or practices. Students may prepare the summary as a Word document or build a wiki; Word documents or links to the wiki must be emailed to the instructor by midnight on Friday to receive credit. Students will receive 5 points for a complete summary, 3 points for an incomplete summary, and no points for a late or missing submission.</p> <p></p> represents a block; <strong></strong> represents in-line.
  • 13. <?xml version="1.0" encoding="utf-8"?> <assignments> <assignment> <duedate>09/27/2011</duedate> <name>Homework 1 - Using XML</name> </assignment> <assignment> <duedate>10/11/2011</duedate> <name>Homework 2 - DOM</name> </assignment> <assignment> <duedate>10/18/2011</duedate> <name>Homework 3 - DTD</name> </assignment> … </assignments>
  • 14. assignment { font-family: Verdana, Geneva, Tahoma, sans-serif; font-size: medium; font-weight: bold; display:inline; color: #0000FF; } duedate { background-color: #99CCFF; } Each assignment immediately follows prior assignment
  • 15. assignment { font-family: Verdana, Geneva, Tahoma, sans-serif; font-size: medium; font-weight: bold; display:block; color: #0000FF; } duedate { background-color: #99CCFF; display:inline; } Each assignment is on a new line (block)
  • 16. Normal flow (default) presents one element after another from top to bottom ◦ Can include relative positioning to offset a box from the preceding element  Float positioning allows other content to flow around ◦ Set a width to specify how much of the containing box to use – otherwise will take up 100% of the space  Absolute positioning specifies a fixed location to place content ◦ Set the top and left properties ◦ Fixed can be used to make position about the browser window
  • 17. assignments { background-color: #C0C0C0; border: medium groove #0000FF; margin: 0px; Creates border around contents padding: 10px; and sets background (applies to display: block; root element) } assignment { margin: 5px; font-family: Verdana, Geneva, Tahoma, sans-serif; font-size: medium; font-weight: bold; display: block; color: #0000FF; } duedate { background-color: #CCCCFF; display: inline; float: right; } Due date comes after name (float)
  • 18. Tabular data can be displayed using float positioning or using display settings ◦ Float positioning is shown in In-line v. Block: Block  Display settings include ◦ table; ◦ table-row; ◦ table-cell;
  • 19. assignment { display: table-row; } name { display:table-cell; font-style:italic; padding:10px; } duedate { display: table-cell; font-weight:bold; padding:10px; } assignments { padding: 10px; display: table; }