Você está na página 1de 7

What is the World Wide Web (WWW)?

The World Wide Web (WWW) is most often called the Web. The Web is a network of computers all over the world. All the computers in the Web can communicate with each other. All the computers use a communication standard called HTTP.

How does the WWW work?


Web information is stored in documents called Web pages. Web pages are files stored on computers called Web servers. Computers reading the Web pages are called Web clients. Web clients view the pages with a program called a Web browser. Popular browsers are Internet Explorer and Netscape Navigator.

How does the browser fetch the pages?


A browser fetches a Web page from a server by a request. A request is a standard HTTP request containing a page address. A page address looks like this: http://www.someone.com/page.htm.

How does the browser display the pages?


All Web pages contain instructions for display The browser displays the page by reading these instructions. The most common display instructions are called HTML tags. HTML tags look like this <p>This is a Paragraph</p>.

Who develops the Web standards?


The Web standards are not made up by any individual company, such as Netscape or Microsoft. The rule-making body of the Web is the W3C. W3C stands for the World Wide Web Consortium. W3C puts together specifications for Web standards. The most essential Web standards are HTML, CSS and XML.

The latest XHTML standard is XHTML 2.0. However, the earlier standards (XHTML 1.1, 1.0) are still commonly used.

What is an HTML File?


HTML stands for Hyper Text Markup Language An HTML file is a text file containing small markup tags The markup tags tell the Web browser how to display the page An HTML file must have an htm or html file extension An HTML file can be created using a simple text editor

Example:
<html> <head> <title>Title of page</title> </head> <body> This is my first homepage. <b>This text is bold</b> </body> </html>

Example explained:

The first tag in your HTML document is <html>. This tag tells your browser that this is the start of an HTML document. The last tag in your document is </html>. This tag tells your browser that this is the end of the HTML document. The text between the <head> tag and the </head> tag is header information. Header information is not displayed in the browser window. The text between the <title> tags is the title of your document. The title is displayed in your browser's caption. The text between the <body> tags is the text that will be displayed in your browser. The text between the <b> and </b> tags will be displayed in a bold font.

What is XHTML?

XHTML stands for EXtensible HyperText Markup Language XHTML is aimed to replace HTML

XHTML is almost identical to HTML 4.01 XHTML is a stricter and cleaner version of HTML XHTML is HTML defined as an XML application

XHTML is a combination of HTML and XML (eXtensible Markup Language).XHTML consists of all the elements in HTML 4.01 combined with the syntax (structure) of XML.

Why XHTML over HTML 4.01?


We have reached a point where many pages on the web contain "bad" HTML. The following HTML code will work fine if you view it in a browser, even if it does not follow the HTML rules:
<html> <head> <title>This is bad HTML</title> <body> <h1>Bad HTML </body>

The advantages of using XHTML over HTML are:


Stability Usability Extensibility

Stability: Documents will be more stable since adhering to good XHTML: 1. ensures the optimal browser support provided by future XML-based user agents such as cellphones and PDAs. 2. satisfies today's HTML-based browsers. Today's market consists of different browser technologies, some browsers run internet on computers, and some browsers run internet on mobile phones and hand helds. The last-mentioned do not have the resources or power to interpret a "bad" markup language. 3. XHTML gives the opportunity to write "well-formed" documents. Usability: XML was designed to describe data and HTML was designed to display data.

Strict XHTML forces authors: 1. to separate content from formatting. 2. to use style sheets for formatting and layout. Separating content from formatting offers greater accessibility and device-independence, and makes managing a site's design much easier. Extensibility: XHTML pages can be read by all XML enabled devices.

Differences Between XHTML and HTML


The Most Important Differences:

XHTML elements must be properly nested XHTML documents must be well-formed Tag names must be in lowercase All XHTML elements must be closed

Elements Must Be Properly Nested


In HTML some elements can be improperly nested within each other like this:
<b><i>This text is bold and italic</b></i>

In XHTML all elements must be properly nested within each other like this:
<b><i>This text is bold and italic</i></b>

Note: A common mistake in nested lists, is to forget that the inside list must be within an li element, like this:
<ul> <li>Coffee</li> <li>Tea <ul> <li>Black tea</li> <li>Green tea</li> </ul> <li>Milk</li> </ul>

This is correct:
<ul> <li>Coffee</li> <li>Tea <ul> <li>Black tea</li> <li>Green tea</li> </ul> </li> <li>Milk</li> </ul>

Notice that we have inserted a </li> tag after the </ul> tag in the "correct" code example.

Documents Must Be Well-formed


All XHTML elements must be nested within the <html> root element. All other elements can have sub (children) elements. Sub elements must be in pairs and correctly nested within their parent element. The basic document structure is:

<html> <head> ... </head> <body> ... </body> </html>

Tag Names Must Be in Lower Case


This is because XHTML documents are XML applications. XML is case-sensitive. Tags like <br> and <BR> are interpreted as different tags. This is wrong:
<BODY> <P>This is a paragraph</P> </BODY>

This is correct:
<body> <p>This is a paragraph</p> </body>

All XHTML Elements Must Be Closed


Non-empty elements must have an end tag.

This is wrong:
<p>This is a paragraph <p>This is another paragraph

This is correct:
<p>This is a paragraph</p> <p>This is another paragraph</p>

Empty Elements Must also Be Closed


Empty elements must either have an end tag or the start tag must end with />. This is wrong:
This is a break<br> Here comes a horizontal rule:<hr> Here's an image <img src="happy.gif" alt="Happy face">

This is correct:
This is a break<br /> Here comes a horizontal rule:<hr /> Here's an image <img src="happy.gif" alt="Happy face" />

XHTML Validation Service


To validate a website written in XHTML, go to http://validator.w3.org and enter the web address of the page to be checked. Make sure your html file has the following structure: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <title> title of the page </title> </head> <body>

here goes the body of the web page </body> </html> Benefits of validation: 1. Makes sure a site conforms with the web standards. 2. provides error detection

Programming Hints

One of the most important things that many students miss in their first programming class is the concept of style. To achieve better readability and maintenance: o Break things into small pieces.
o

Maintain the most important element of a good style: Consistency. Your code should be consistent in three main conventions: spacing, indentation, and nesting

One of the other important things students tend to overlook is the importance of commenting code.
o

Comments can help you and other people looking at your code to understand what you are trying to do. One common trick is to comment out non-working code as opposed to deleting it. This way, you can just uncomment it when you figure out why it is not working properly

Você também pode gostar