SlideShare a Scribd company logo
1 of 30
Download to read offline
Side Trip: XHTML




           Using XHTML
XHTML

●   Extensible Hypertext Markup Language
●   Supposedly the replacement for HTML.
●   Reformulation of HTML in XML.
    –   Still like HTML with the rules of XML (on
        wellformedness).
Required Elements in XHTML

●   <!DOCTYPE>
    –   One of three doctypes.
●   <html>
    –   Root element
●   <head>
●   <title>
●   <body>
Differences from HTML

●   Always well-formed.
●   Some elements are required elements.
●   Some elements in HTML that are formatting, e.g.
    <b>, <i>, etc. are avoided (Even absent) in
    XHTML.
    –   Presentation rules should be defined in CSS.
●   All tags, attributes and even attribute values are in
    lowercase characters.
●   Some attributes of some elements are required
    –   OTHERWISE your XHTML document is NOT valid
The DOCTYPES

●   XHTML Transitional
    –   Compatibility with old browsers that does not support
         CSS.
●   XHTML Strict
        –   Free from presentational elements.
●   XHTML Frameset
        –   When using <frameset> & <frame>
XHTML Template

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-
  transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title goes here</title>
</head>

<body>
</body>

</html>
Where It's Going

●   XHTML 1.1 : Modularized XHTML
●   XHTML 2.0 : Still In Development
    –   HTML Forms to be replaced by XForms
    –   HTML frames to be replaced by XFrames
    –   Any element can become a hyperlink
    –   Etc..
Validating XHTML Documents
Presentation of (XML) Data for the
Web
XML: Separation of Data From
Presentation
●   XML Documents are data-centric.
    –   Markup of data only.
●   XML Documents should be free from
    presentation/styling/display/formatting elements.
    –   No elements included as to how other elements should
        be formatted
    –   This would keep any XML portable and
        display-“platform” independent.
Presentation of XML Data using
Stylesheet
●   A Stylesheet
    –   A specification on how to display the data.
●   Cascading Stylesheets (CSS)
    –   Added to HTML to solve rendering consistency
        problems
    –   With CSS We can specify how to exactly display
        HTML elements.
    –   CSS can be applied to XML documents as well.
CSS: Attaching to HTML

●   External Stylesheets
    –   CSS rules written in separate file
    –   Linked via

    <link rel=”stylesheet”
          href=”styles.css”
          type=”text/css” />

    <!-- styles.css is the URL of the
         CSS file -->
CSS: Attaching to HTML

●   Internal Stylesheets
    –   Style rules written inside <style> inside <head>


    <html>
         <head>
            <style>

            //style rules here
            </style>
         </head>
    . . .
CSS: Attaching to HTML

●   Inline Style
    –   Style rules written inside in style attribute in
        presentable elements



    <p style=”font:Arial”> ... </p>
    . . .
CSS Syntax

   selector { property : value;
              property2 : value2
                 }

               Example:
    p { font-family : “sans serif” }

       p { text-align: centery;
            color : red }
Specifying Selectors

●   Element name (e.g. <p>, <a> etc... }
    a { text-decoration: none }
    //represents the <a> elements

●   Element Class (specified by class attribute)

    .reddish { color:red }
    div.reddish { background-color : red }

    Corresponds to the ff:
    <a class=”reddish”>
    <div class=”reddish”>
Specifying Selectors

●   Element ID (specified by id attribute
    #unique { border : 1px solid black }
    a#unico { display: block }

    Corresponds to
    <p id=”unique”>
    <a id=”unico”>
Specifying Selectors

●   Grouped Selector
    h1,h2,h3,h4,h5,h6,h7 {
        color: blue
    }
●   Heirarchial Selector
    p a {
        text-decoration: none;
        color red;
    }
    // applies to: <a> elems inside <p>
Specifying Selectors

●   Element with Specific Attribute


input[type=”text”] {
     border: 1px solid red
}
/* applies to <input type=”text”>
elems, IE sucks on this
dunno about IE 7 though */
Specifying Selectors

●   Pseudo-classes


a:link { color: #FFFF00 }
a:hover { color: rgb(123,234,54) }
a:visited { color: salmon }
CSS Properties and Their Values

●   Background Properties   ●   Dimension
●   Text                    ●   Classification
●   Font                    ●   Positioning
●   Border                  ●   Print (CSS2 Media)
●   Margin                  ●   Aural (CSS2 Media)
●   Padding
●   List
CSS Properties and Their Values

●   Consult a CSS Reference for the different property
    names and their possible values.
CSS Inheritance

●   Most CSS properties are inheritable from more
    general selectors to more specific selectors
●   When two properties conflict, the more specific
    rule is applied, otherwise the rules combine.
Observe:

/* CSS Rules */             <!-- HTML Markup-->

a{                          <a href=””>Link 1</a>
    font-family: “sans
      serif”;               <div>
    color:red               <a href=””>Link 2</a>
    }
                            </div>
div a {
    color:blue;
    text-decoration:none;
}
CSS Rule application:

●   Browser Default
●   External CSS
●   Internal CSS
●   Inline


In terms of selector, the rules of the most specific
  selector that applies to an element overwrites any
  less specific declarations.
XML + CSS = Web Page

●   With any XML document, we can apply CSS to
    display it as web page.
●   The selectors will be the elements of the XML
    documents.

More Related Content

What's hot

What's hot (20)

XML Technologies
XML TechnologiesXML Technologies
XML Technologies
 
Web front end development introduction to html css and javascript
Web front end development introduction to html css and javascriptWeb front end development introduction to html css and javascript
Web front end development introduction to html css and javascript
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
Unit 3 (it workshop).pptx
Unit 3 (it workshop).pptxUnit 3 (it workshop).pptx
Unit 3 (it workshop).pptx
 
Xml
Xml Xml
Xml
 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
Xsd tutorial
Xsd tutorialXsd tutorial
Xsd tutorial
 
CSS
CSSCSS
CSS
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
Xml
Xml Xml
Xml
 
CSS
CSSCSS
CSS
 
Css Basics
Css BasicsCss Basics
Css Basics
 
FFW Gabrovo PMG - JavaScript 1
FFW Gabrovo PMG - JavaScript 1FFW Gabrovo PMG - JavaScript 1
FFW Gabrovo PMG - JavaScript 1
 
FFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTMLFFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTML
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
FFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQueryFFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQuery
 

Viewers also liked (11)

Chapter2a
Chapter2aChapter2a
Chapter2a
 
Chapter2c
Chapter2cChapter2c
Chapter2c
 
Cmsc 100 (web content)
Cmsc 100  (web content)Cmsc 100  (web content)
Cmsc 100 (web content)
 
Chapter2a
Chapter2aChapter2a
Chapter2a
 
Chapter2b
Chapter2bChapter2b
Chapter2b
 
Chapter1b
Chapter1bChapter1b
Chapter1b
 
linked list (CMSC 123)
linked list (CMSC 123)linked list (CMSC 123)
linked list (CMSC 123)
 
Chapter1c
Chapter1cChapter1c
Chapter1c
 
Cmsc 100 (web programming in a nutshell)
Cmsc 100 (web programming in a nutshell)Cmsc 100 (web programming in a nutshell)
Cmsc 100 (web programming in a nutshell)
 
Chapter2d
Chapter2dChapter2d
Chapter2d
 
Chapter1a
Chapter1aChapter1a
Chapter1a
 

Similar to Cmsc 100 xhtml and css

Ifi7174 lesson2
Ifi7174 lesson2Ifi7174 lesson2
Ifi7174 lesson2
Sónia
 
css-presentation.ppt
css-presentation.pptcss-presentation.ppt
css-presentation.ppt
prathur68
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
Tesfaye Yenealem
 
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...
JebaRaj26
 
ch04-css-basics_final.ppt
ch04-css-basics_final.pptch04-css-basics_final.ppt
ch04-css-basics_final.ppt
GmachImen
 

Similar to Cmsc 100 xhtml and css (20)

Ifi7174 lesson2
Ifi7174 lesson2Ifi7174 lesson2
Ifi7174 lesson2
 
css-presentation.ppt
css-presentation.pptcss-presentation.ppt
css-presentation.ppt
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
 
Web technology Unit-II Part-C
Web technology Unit-II Part-CWeb technology Unit-II Part-C
Web technology Unit-II Part-C
 
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...
 
An Introduction to Cascading Style Sheets (CSS3)
An Introduction to Cascading Style Sheets (CSS3)An Introduction to Cascading Style Sheets (CSS3)
An Introduction to Cascading Style Sheets (CSS3)
 
IP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).pptIP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).ppt
 
Cascading Style Sheets By Mukesh
Cascading Style Sheets By MukeshCascading Style Sheets By Mukesh
Cascading Style Sheets By Mukesh
 
Css introduction
Css  introductionCss  introduction
Css introduction
 
Web Programming-css.pptx
Web Programming-css.pptxWeb Programming-css.pptx
Web Programming-css.pptx
 
Css
CssCss
Css
 
CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
 
ch04-css-basics_final.ppt
ch04-css-basics_final.pptch04-css-basics_final.ppt
ch04-css-basics_final.ppt
 
Css
CssCss
Css
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
 
TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1
 
CascadingStyleSheets in ONESHOT By DeathCodeYT .pdf
CascadingStyleSheets  in ONESHOT By DeathCodeYT .pdfCascadingStyleSheets  in ONESHOT By DeathCodeYT .pdf
CascadingStyleSheets in ONESHOT By DeathCodeYT .pdf
 
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Cmsc 100 xhtml and css

  • 1. Side Trip: XHTML Using XHTML
  • 2. XHTML ● Extensible Hypertext Markup Language ● Supposedly the replacement for HTML. ● Reformulation of HTML in XML. – Still like HTML with the rules of XML (on wellformedness).
  • 3. Required Elements in XHTML ● <!DOCTYPE> – One of three doctypes. ● <html> – Root element ● <head> ● <title> ● <body>
  • 4. Differences from HTML ● Always well-formed. ● Some elements are required elements. ● Some elements in HTML that are formatting, e.g. <b>, <i>, etc. are avoided (Even absent) in XHTML. – Presentation rules should be defined in CSS. ● All tags, attributes and even attribute values are in lowercase characters. ● Some attributes of some elements are required – OTHERWISE your XHTML document is NOT valid
  • 5. The DOCTYPES ● XHTML Transitional – Compatibility with old browsers that does not support CSS. ● XHTML Strict – Free from presentational elements. ● XHTML Frameset – When using <frameset> & <frame>
  • 6. XHTML Template <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Title goes here</title> </head> <body> </body> </html>
  • 7. Where It's Going ● XHTML 1.1 : Modularized XHTML ● XHTML 2.0 : Still In Development – HTML Forms to be replaced by XForms – HTML frames to be replaced by XFrames – Any element can become a hyperlink – Etc..
  • 9.
  • 10.
  • 11.
  • 12. Presentation of (XML) Data for the Web
  • 13. XML: Separation of Data From Presentation ● XML Documents are data-centric. – Markup of data only. ● XML Documents should be free from presentation/styling/display/formatting elements. – No elements included as to how other elements should be formatted – This would keep any XML portable and display-“platform” independent.
  • 14. Presentation of XML Data using Stylesheet ● A Stylesheet – A specification on how to display the data. ● Cascading Stylesheets (CSS) – Added to HTML to solve rendering consistency problems – With CSS We can specify how to exactly display HTML elements. – CSS can be applied to XML documents as well.
  • 15. CSS: Attaching to HTML ● External Stylesheets – CSS rules written in separate file – Linked via <link rel=”stylesheet” href=”styles.css” type=”text/css” /> <!-- styles.css is the URL of the CSS file -->
  • 16. CSS: Attaching to HTML ● Internal Stylesheets – Style rules written inside <style> inside <head> <html> <head> <style> //style rules here </style> </head> . . .
  • 17. CSS: Attaching to HTML ● Inline Style – Style rules written inside in style attribute in presentable elements <p style=”font:Arial”> ... </p> . . .
  • 18. CSS Syntax selector { property : value; property2 : value2 } Example: p { font-family : “sans serif” } p { text-align: centery; color : red }
  • 19. Specifying Selectors ● Element name (e.g. <p>, <a> etc... } a { text-decoration: none } //represents the <a> elements ● Element Class (specified by class attribute) .reddish { color:red } div.reddish { background-color : red } Corresponds to the ff: <a class=”reddish”> <div class=”reddish”>
  • 20. Specifying Selectors ● Element ID (specified by id attribute #unique { border : 1px solid black } a#unico { display: block } Corresponds to <p id=”unique”> <a id=”unico”>
  • 21. Specifying Selectors ● Grouped Selector h1,h2,h3,h4,h5,h6,h7 { color: blue } ● Heirarchial Selector p a { text-decoration: none; color red; } // applies to: <a> elems inside <p>
  • 22. Specifying Selectors ● Element with Specific Attribute input[type=”text”] { border: 1px solid red } /* applies to <input type=”text”> elems, IE sucks on this dunno about IE 7 though */
  • 23. Specifying Selectors ● Pseudo-classes a:link { color: #FFFF00 } a:hover { color: rgb(123,234,54) } a:visited { color: salmon }
  • 24. CSS Properties and Their Values ● Background Properties ● Dimension ● Text ● Classification ● Font ● Positioning ● Border ● Print (CSS2 Media) ● Margin ● Aural (CSS2 Media) ● Padding ● List
  • 25. CSS Properties and Their Values ● Consult a CSS Reference for the different property names and their possible values.
  • 26. CSS Inheritance ● Most CSS properties are inheritable from more general selectors to more specific selectors ● When two properties conflict, the more specific rule is applied, otherwise the rules combine.
  • 27. Observe: /* CSS Rules */ <!-- HTML Markup--> a{ <a href=””>Link 1</a> font-family: “sans serif”; <div> color:red <a href=””>Link 2</a> } </div> div a { color:blue; text-decoration:none; }
  • 28.
  • 29. CSS Rule application: ● Browser Default ● External CSS ● Internal CSS ● Inline In terms of selector, the rules of the most specific selector that applies to an element overwrites any less specific declarations.
  • 30. XML + CSS = Web Page ● With any XML document, we can apply CSS to display it as web page. ● The selectors will be the elements of the XML documents.