Introduction to WWW

Embed Size (px)

Citation preview

  • 7/27/2019 Introduction to WWW

    1/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 serverby 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

    This is a Paragraph

    .

    Who develops the Web standards?

    The Web standards are not made up by any individual company, such as Netscape orMicrosoft.

    The rule-making body of the Web is the W3C.

    W3C stands for the World Wide Web Consortium.

    W3C puts together specifications forWeb standards.

    The most essential Web standards are HTML, CSS and XML.

  • 7/27/2019 Introduction to WWW

    2/7

    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 forHyperText Markup Language An HTML file is a text file containing small markup tags

    The markup tags tell the Web browserhow to display the page

    An HTML file must have an htm orhtml file extension

    An HTML file can be created using a simple text editor

    Example:

    Title of page

    This is my first homepage. This text isbold

    Example explained:

    The first tag in your HTML document is . This tag tells your browser that this isthe start of an HTML document.

    The last tag in your document is . This tag tells your browser that this is the end

    of the HTML document.

    The text between the tag and the tag is header information. Header

    information is not displayed in the browser window.

    The text between the tags is the title of your document. The title is displayed in

    your browser's caption.

    The text between the tags is the text that will be displayed in your browser.

    The text between the and tags will be displayed in a bold font.

    What is XHTML?

    XHTML stands for EXtensible HyperText Markup Language

    XHTML is aimed to replace HTML

  • 7/27/2019 Introduction to WWW

    3/7

    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 consistsof 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:

    This is bad HTMLBad HTML

    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 interneton 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.

  • 7/27/2019 Introduction to WWW

    4/7

    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, andmakes 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:

    This text is bold and italic

    In XHTML all elements must be properly nested within each other like this:

    This text is bold and italic

    Note: A common mistake in nested lists, is to forget that the inside list must be within an li

    element, like this:

    CoffeeTeaBlack teaGreen tea

    Milk

  • 7/27/2019 Introduction to WWW

    5/7

    This is correct:

    CoffeeTea

    Black teaGreen tea

    Milk

    Notice that we have inserted a tag after the tag in the "correct" code example.

    Documents Must Be Well-formed

    All XHTML elements must be nested within the 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:

    ... ...

    Tag Names Must Be in Lower Case

    This is because XHTML documents are XML applications. XML is case-sensitive. Tags like
    and
    are interpreted as different tags.

    This is wrong:

    This is a paragraph

    This is correct:

    This is a paragraph

    All XHTML Elements Must Be Closed

    Non-empty elements must have an end tag.

  • 7/27/2019 Introduction to WWW

    6/7

    This is wrong:

    This is a paragraph

    This is another paragraph

    This is correct:

    This is a paragraph

    This is another paragraph

    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
    Here comes a horizontal rule:Here's an image

    This is correct:

    This is a break

    Here comes a horizontal rule:Here's an image

    XHTML Validation Service

    To validate a website written in XHTML, go tohttp://validator.w3.org and enter the web address

    of the page to be checked.

    Make sure your html file has the following structure:

    title of the page

    http://validator.w3.org/http://validator.w3.org/http://validator.w3.org/
  • 7/27/2019 Introduction to WWW

    7/7

    here goes the body of the web page

    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 ofstyle. To achieve betterreadability and maintenance:

    o Breakthings 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.

    o One common trick is to comment out non-working code as opposed to deletingit. This way, you can just uncomment it when you figure out why it is not working

    properly