XHTML for Content Structure Chapter 3. Overview and Objectives Discuss briefly the history of, and relationship between, HTML and XHTML Stress the importance.

Slides:



Advertisements
Similar presentations
HTML Basics 1450 Technology Seminar Copyright 2003, Matthew Hottell.
Advertisements

HTML: HyperText Markup Language Hello World Welcome to the world!
HTML/XML XHTML Authoring. Creating Tables  Table: An arrangement of horizontal rows and vertical columns. The intersection of a row and a column is called.
HTML and XHTML Controlling the Display Of Web Content.
XHTML and CSS Overview. Hypertext Markup Language A set of markup tags and associated syntax rules Unlike a programming language, you cannot describe.
XHTML1 Tables and Lists. XHTML2 Objectives In this chapter, you will: Create basic tables Structure tables Format tables Create lists.
Unit 2, cont. September 14 HTML,Validating your pages, Publishing your site.
 2008 Pearson Education, Inc. All rights reserved. 1 Introduction to HTML.
XHTML and CSS Overview. Hypertext Markup Language A set of markup tags and associated syntax rules Unlike a programming language, you cannot describe.
Database-Driven Web Sites, Second Edition1 Chapter 2 INTRODUCTION TO HTML.
Computer Sciences Department
Creating a Simple Page: HTML Overview
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
HTML HTML stands for "Hyper Text Mark-up Language“. Technically, HTML is not a programming language, but rather a markup language. Used to create web pages.
HTML (HyperText Markup Language)
Amber Annett David Bell October 13 th, What will happen What is this business about personal web pages? Designated location of your own web page.
Programming in HTML.  Programming Language  Used to design/create web pages  Hyper Text Markup Language  Markup Language  Series of Markup tags 
Chapter 4: Hypertext Markup Language Primer TECH Prof. Jeff Cheng.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML Pt. 2.
HTML history, Tags, Element. HTML: HyperText Markup Language Hello World Welcome to the world!
Chapter 1 XHTML: Part I The Web Warrior Guide to Web Design Technologies.
Using Html Basics, Text and Links. Objectives  Develop a web page using HTML codes according to specifications and verify that it works prior to submitting.
CS134 Web Design & Development Creating a Basic Web Page Exerted from Mehmud Abliz slides.
Learning Web Design: Chapter 4. HTML  Hypertext Markup Language (HTML)  Uses tags to tell the browser the start and end of a certain kind of formatting.
Chapter 2 HTML Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
HTML Hyper-Text Markup Language or tags. HTML is a “tag” language Open and close tags Tags identified with angle brackets Basic format content (shorthand.
1 CSC 121 Computers and Scientific Thinking David Reed Creighton University HTML and Web Pages.
Section 4.1 Format HTML tags Identify HTML guidelines Section 4.2 Organize Web site files and folder Use a text editor Use HTML tags and attributes Create.
Programming in HTML.  Programming Language  Used to design/create web pages  Hyper Text Markup Language  Markup Language  Series of Markup tags 
Getting Started with HTML Please use speaker notes for additional information!
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
A Basic Web Page. Chapter 2 Objectives HTML tags and elements Create a simple Web Page XHTML Line breaks and Paragraph divisions Basic HTML elements.
INTRODUCTION. What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is not a programming language,
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
HTML: Hyptertext Markup Language Doman’s Sections.
XHTML 1.1  Derived from Standard Generalized Markup Language (SGML) of ISO  XHTML concerned primary with content rather than presentation and style 
XHTML1-1 Extensible HyperText Markup Language (XHTML) Part 2 Xingquan (Hill) Zhu
Lesson 4.
Introduction HTML (Hypertext Markup Language) is used to create document on the World Wide Web. HTML is not a programming language, it is a markup language.
COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 2.
4 Chapter Four Introduction to HTML. 4 Chapter Objectives Learn basic HTML commands Discover how to display graphic image objects in Web pages Create.
Ali Alshowaish. What is HTML? HTML stands for Hyper Text Markup Language Specifically created to make World Wide Web pages Web authoring software language.
Web Development & Design Foundations with XHTML Chapter 2 HTML/XHTML Basics.
COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 2.
©SoftMoore ConsultingSlide 1 Introduction to HTML: Basic Document Structure.
HTML Basics. HTML Coding HTML Hypertext markup language The code used to create web pages.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
CS3101 Internet Programming. Chapter 01 Introduction to XHTML 2Internet Programming - Chapter 01:XHTML Slides based on: Programming the World Wide Web.
1999, COMPUTER SCIENCE, BUU Introduction to HTML Seree Chinodom
INT222 – Internet Fundamentals
Tutorial #1 Using HTML to Create Web Pages. HTML, XHTML, and CSS HTML – HyperText Markup Language The tags the browser uses to define the content of the.
Building a Web Page. A Brief History In 1989, Tim Berners-Lee invented the Web. To enable particle physics from around the world to organize and share.
1 Week 3 XTML, Expression Web, WinSCP, & Mini-Project (MP1) Advanced Web Development IT225 Spring Term 2016 Marymount University School of Business Administration.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 1 Using HTML to Create Web Pages.
School of Business Administration HTML, Expression Web, WinSCP, &
Marking Up with XHTML Tags describe how a web page should look
HTML: HyperText Markup Language
XHTML for Content Structure
Chapter 1: Introduction to XHTML (part 1)
Introduction to XHTML.
COMPUTING FUNDAMENTALS
Computers and Scientific Thinking David Reed, Creighton University
Marking Up with XHTML Tags describe how a web page should look
1 Introduction to XHTML.
Introduction to HTML.
Marking Up with XHTML Tags describe how a web page should look
Marking Up with XHTML Tags describe how a web page should look
Marking Up with XHTML Tags describe how a web page should look
Presentation transcript:

XHTML for Content Structure Chapter 3

Overview and Objectives Discuss briefly the history of, and relationship between, HTML and XHTML Stress the importance of maintaining both a conceptual and a physical separation between the structure and presentation of a web page Discuss XHTML tags and elements, comparing and contrasting HTML rules with XHTML rules Discuss the basic structure of every web page Discuss and illustrate all of the usual basic XHTML markup, including headings, paragraphs, line breaks, tables, images, comments, attributes and entities Discuss multipage websites and the links used to connect them Discuss the use of Server-Side Includes (SSI) which allow common markup used in many pages to be kept in one location Discuss DOCTYPE declarations and the validation of XHTML markup Chapter 3: XHTML for Content Structure 2

What is XHTML? A markup language, not a programming language Uses markers called “tags” to designate the structural elements of a web page (headings, paragraphs, lists, and the like) Derives from HTML (HyperText Markup Language), which in turn derives from SGML (Standard Generalized Markup Language) Has much stricter rules than HTML A new version of HTML, HTML 5, will eventually supersede XHTML Chapter 3: XHTML for Content Structure 3

Summary of (X)HTML Versions HTML (1990) Tim Berners-Lee HTML 2 (1992) HTML 3.2 (1996) HTML 4 (1997) and HTML 4.01 (1999) XHTML 1.0 (2000) and XHTML 1.1 (2001) XHTML 2.0 (work discontinued by 2010) HTML 5 (coming along, but not yet a standard) Chapter 3: XHTML for Content Structure 4

XHTML for Structure Only Right up front we need to make these high-level distinctions: XHTML’s job is to describe the structure of a web page Web page presentation is the job of Cascading Style Sheets (CSS) Web page behavior is the job of JavaScript Chapter 3: XHTML for Content Structure 5

A Typical XHTML Tag and Element Here is an XHTML paragraph element: This is a paragraph. is the opening tag of the element. is the closing tag of the element. This is a paragraph. is the content of the element. Sometimes we refer to the “tag pair” …. Sometimes we refer to the “ p tag” or simply a “ p element”. Chapter 3: XHTML for Content Structure 6

Browser Display of XHTML Elements Every browser will have its own default way of displaying any XHTML element. For a paragraph this might include space before and after the text, and the text font. Browsers also have certain “default behavior”: – Reducing multiple spaces between words to a single space – Wrapping lines as the browser window changes size Chapter 3: XHTML for Content Structure 7

Basic Structure of Every Web Page My Title <!--An XHTML comment showing where page content to display will go.--> Chapter 3: XHTML for Content Structure 8

Some Basic Markup Tags h1, h2, h3, h4, h5, h6 for headings p for paragraphs ul for unordered lists ( marker by default) ol for ordered lists (numbered 1, 2, 3 … by default) li for list items in an ordered or unordered list Chapter 3: XHTML for Content Structure 9

Basic XHTML Markup Illustrated: first.html Nature's Source Welcome to the Website of Nature's Source This is our first foray onto the World Wide Web. We are a small company dedicated to the health of our customers through natural remedies. We have a wide range of products that include: - books, and multimedia documents that help you get healthy and stay healthy - herbal medicines - equipment for injury free body toning exercises Chapter 3: XHTML for Content Structure 10

Basic XHTML Markup Displayed: first.html Chapter 3: XHTML for Content Structure 11 Note how the text from the file loses its formatting when displayed in the browser Courtesy of Nature’s Source

An Empty Element for Line Breaks: br Not all elements have content. Elements with no content are called “empty elements” and have a special syntax. The line break element is one of these. It causes the following text to appear on the next line but with no additional spacing. It has just a single tag, and note the blank space preceding the / (forward slash) at the end. Chapter 3: XHTML for Content Structure 12

More XHTML Markup Illustrated: second.html Nature's Source Welcome to the Website of Nature's Source! This is our first foray onto the World Wide Web. We are a small company dedicated to the health of our customers through natural remedies. We have a wide range of products that include: books, and multimedia documents that help you get healthy and stay healthy herbal medicines equipment for injury free body toning exercises Chapter 3: XHTML for Content Structure 13

More XHTML Markup Displayed: second.html Chapter 3: XHTML for Content Structure 14 Courtesy of Nature’s Source

An Empty Element for Images: img and Tag Attributes The img element lets us place an image on a web page. A typical image element: src and alt are called attributes. The value of src is the location of the image file. The value of alt is the text to display if no image. Attribute values are enclosed in quotes. Chapter 3: XHTML for Content Structure 15

A Best Practice for Images A pixel is a very small area of illumination on a display screen, one of many from which an image is composed. The img tag has two optional attributes, width and height, whose values in number of pixels give the size of an image. A browser will scale the image to that size, but it is better to make the image the size you want in an external program and then specify the exact size in your img tag. Then … no scaling required. Chapter 3: XHTML for Content Structure 16

Block Elements vs. Inline Elements Some XHTML elements are block elements, others are inline elements. Block elements (headings, paragraphs and lists, for example) flow from top to bottom of a web page, with a browser-dependent amount of vertical whitespace before and after the element. Inline elements (the img element, for example) flow from left to right, wrapping to the next line as necessary, with no horizontal spacing surrounding the element. Chapter 3: XHTML for Content Structure 17

Tables in General Tables have rows and columns. Tables are best used to display data that lends itself to rows and columns. Example: A table of 28 temperatures with 4 rows (weeks) and 7 columns (week days) A table can be used to lay out a very simple web page, but Divisions are much preferred for web page layout. Chapter 3: XHTML for Content Structure 18

XHTML Basic Table Elements A table element with two rows and two columns (two table data cells) in each row: top-left top-right top-left top-right Chapter 3: XHTML for Content Structure 19

Additional Table Features Content of a td (table data) element is displayed left-justified by default. Content of a th (table header) element is displayed bold and centered by default. Table attribute border="n" places a border n pixels wide around the table. td and th tags can take have rowspan="n" and colspan="n" attributes to permit one cell to span multiple rows and/or columns Chapter 3: XHTML for Content Structure 20

Simple Table Layout in index.html from nature1 (two rows and two columns) Chapter 3: XHTML for Content Structure 21 Courtesy of Nature’s Source

What is an XHTML Entity? Some characters have a special meaning in XHTML ( < starts an opening tag, for example). So how do I actually display a “ < “ if you need to So, for example, in small tag in a big element. This problem is solved by this XHTML entity: < (lt: less than) A browser replaces the entity < with the single character <. Chapter 3: XHTML for Content Structure 22

Some XHTML Entities Characters that need replacing by entities are often called metacharacters. Entities can also provide special characters not appearing on keyboards. Some additional XHTML entities: – > for > – & for & – © for © (the copyright symbol) Chapter 3: XHTML for Content Structure 23

XHTML Hyperlinks A central idea of the web is that one page can link to one or many others. The a (anchor) element provides the hyperlink (link). The value of the (required) href attribute of an a tag is the URL or path to the other page. A typical a element: Our Products By default content like Our Products appears with blue and underlined text. The content of an a element can be an img element. Chapter 3: XHTML for Content Structure 24

Simple Table Layout in index.html from nature2 (four rows and five columns) (and now including “menu item” links) Chapter 3: XHTML for Content Structure 25 Courtesy of Nature’s Source

Our “About Us” Page, with Additional Relevant Links Chapter 3: XHTML for Content Structure 26 Courtesy of Nature’s Source

Our “Site Map” Page, with a (nested) Table Showing Site Map Data Chapter 3: XHTML for Content Structure 27 Courtesy of Nature’s Source

The Classic “Maintenance Nightmare” You have some (maybe a lot) of material that you want to appear on each page of your website (logo, menu, for example). The traditional “copy and paste” method of getting the same material in different locations is very “dangerous”. It’s too easy to change that “common” material in some, but not all, locations. Chapter 3: XHTML for Content Structure 28

Server-Side Includes (SSI): One Way to Avoid the Maintenance Nightmare Your server must set up to permit server-side includes (check with your admin for details). Material you want included in multiple locations goes into a separate file, say common/logo.html. In each file where you want that material included you place a line like the following: The content of logo.html replaces that line. This works for Apache. Other servers may differ. Chapter 3: XHTML for Content Structure 29

What is a “valid” web page? A valid web page is one that conforms to one of several possible standards. The standard against which the page will be validated is determined by a DOCTYPE declaration in the web page. We use this DOCTYPE declaration (requiring the strict version of XHTML) as the first line of a file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " Chapter 3: XHTML for Content Structure

Some XHTML “Boilerplate” The term boilerplate refers to markup that we can use “as is” on every page, and we need some when we attempt to validate a web page. The first boilerplate item is the DOCTYPE itself. The second is the attribute of the html tag: xmlns=" The third is the (empty) meta element within head element: We’ll say more about these much later when we discuss XML in Chapter 11. Chapter 3: XHTML for Content Structure 31

What XHTML Rules Must We Follow? All tag names must use lower case. All tag pairs must be properly nested. Any non-empty element must have both an opening tag and a closing tag. Any attribute must be lower case and have a value which is enclosed in quotes. Block elements may contain block or inline elements, inline elements may only contain other inline elements. Chapter 3: XHTML for Content Structure 32

Some Causes of Invalid Web Pages There are some things we should always do, or not do, to ensure validity of our web pages: Do make sure your page has all of these elements in their correct order: – html – head – title – body Don’t use any elements that are deprecated by the DOCTYPE against which you are validating. Chapter 3: XHTML for Content Structure 33

A Simple Valid Web Page: third.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " Nature's Source Welcome to the Website of Nature's Source! This is our first foray onto the World Wide Web. We are a small company dedicated to the health of our customers through natural remedies. We have a wide range of products that include: books, and multimedia documents that help you get healthy and stay healthy herbal medicines equipment for injury free body toning exercises Chapter 3: XHTML for Content Structure 34

How do we validate a web page? You can find a number of (X)HTML validators on the WWW. Here are two: – – You can enter the URL of the page you want validated directly into the validator and click on a button to validate it. Many other ways are possible: For example, the Firefox Web Developer add-in lets you validate the web page you are viewing from a dropdown menu. Chapter 3: XHTML for Content Structure 35

Validating third.html Chapter 3: XHTML for Content Structure 36 © W3C

Validation Report for third.html Chapter 3: XHTML for Content Structure 37 © W3C