Docsity

XHTML and CSS: Building Structured and Styled Web Pages, Slides of Web Design and Development

Partial preview of the text

Download XHTML and CSS: Building Structured and Styled Web Pages and more Slides Web Design and Development in PDF only on Docsity!

XHTML and CSS

Overview

Hypertext Markup Language

  • A set of markup tags and associated syntax

rules

  • Unlike a programming language, you cannot

describe actions or logic

  • You can only describe information structure

and context

  • Markup tags also called elements
  • Data goes here

Cascading

  • Priority is given to the most specific

definitions and then the definitions or rules cascade down to the less specific rules.

  • Priority is also given to definitions that are

“closer” to the content, i.e., embedded and inline styles can be used to override global or attached styles.

General Structure XHTML & CSS syntax

Content

element { attribute: value; attribute: value; … }

Example ESPN

h1 { font-size: 10pt; color: red; }

Why use XHTML?

  • It is the recommended standard (W3C) since 2000 - HTML 4.01 (1999) - XHTML 1.0 (2000)
  • Allows your web page to be parsed by a general XML parser. - Lots of applications support XML parsing.

Web’s 4 Commandments

  1. Make sure your code validates as XHTML
  2. Use Semantic Markup
    • Use tags that describe the content , not the content’s appearance
  3. Structure Documents Logically
    • The HTML code should be in a logical order; Style sheets can reposition items for presentation 4. Use CSS , not or to layout and decorate your pages.

HTML single tags

 HTML has a few tags that are standalone, i.e., no closing tag.

 Image:

 Line break:

 Link:

XHTML single tags

 To meet XML guidelines HTML single tags must to closed with a />

  1. Image:
  2. Line break:
  3. Link:

 Note the space before the />

Browsers ignore whitespace

  • An XHTML document is an ASCII Text document.
  • XHTML renderers ignores, tabs, spaces and line breaks - Allows a web designer to format XHTML code without having an effect on the web page’s rendered appearance.
  • To render tabs, spaces, and line breaks requires using tags and style sheets.

Basic XHTML document

Title Displays in Browser’s Top Bar

Page content here

Lists

Ordered Lists (ol)

Item 1 Item 2 Item 3 Item 4

Unordered Lists (ul)

Item 1 Item 2 Item 3 Item 4

Terms and Definitions

Example

Coffee black hot drink Milk white cold drink

Meaning dl – definition list dt – definition term dd – definition description

Used heavily in early HTML documents which were most scientific papers with lost of definitions and terms

Text identity (semantic)

Emphasized text

Strong text

Definition term

Computer code text

Sample computer code

Keyboard text

Variable

Citation

Hyperlinks

  • Called the anchor tag

ESPN

  • href stands for hypertext reference
  • What is the element name?
  • What is the attribute?
  • What is the attribute’s value
  • What is the content?