Complete newbie question

Discussion in 'HTML' started by Stephen Glynn, Jul 2, 2004.

  1. Can anyone advise me on this or suggest a group where I might seek help?

    I'm trying to work through an introductory exercise in QUE books' "Using
    HTML". This involves writing some text in notepad and then adding
    tags to produce a basic home page for some imaginary family.

    What they tell me to enter is

    <HTML>
    <HEAD>
    <TITLE>The Fayne Family Page</TITLE>
    </HEAD>
    <BODY bgcolor="FFFFFF" text="000000" link = "0000FF" alink="FF0000"
    vlink="800000>

    <H1>The Fayne Family Page</H1>
    <H2>Who We Are</H2>
    <P>

    .... some text...

    <H2>Where We Live</H2>
    <P>

    .... some more text ...

    <H2>Our Special Interests</H2>
    <P>
    .... some more text ...

    <H2>Fun Places We've Been</H2>
    <P>
    .... yet more text ...
    </BODY>
    </HTML>

    This causes the first two paragraphs to vanish, though the last two --
    "Our Special Interests" and "Fun Places We've Been" -- display as the
    book suggests they should, at least in Mozilla 1.6 and IE6. Removing

    <BODY bgcolor="FFFFFF" text="000000" link = "0000FF" alink="FF0000"
    vlink="800000>

    and replacing it with <BODY>, on the other hand, displays the full
    exercise as it's supposed to appear.

    Where have I gone wrong?

    Steve
     
    Stephen Glynn, Jul 2, 2004
    #1
    1. Advertisements

  2. Stephen Glynn

    Deryck Guest

    <BODY bgcolor="FFFFFF" text="000000" link = "0000FF" alink="FF0000"
    vlink="800000>Start by putting a " before the > in the above line. That certainly causes
    IE a problem on my machine although not the one you describe.
    Post the URL of the file too if you can please.

    HTH
    Deryck
     
    Deryck, Jul 2, 2004
    #2
    1. Advertisements

  3. ^^ you missed a double quote.

    Also, numeric colour constants must begin with a hash (#).
    Don't use the deprecated body attributes to style the page. Use a
    stylesheet.
     
    Owen Jacobson, Jul 2, 2004
    #3
  4. Stephen Glynn

    Neal Guest

    Change your open body tag to:

    <BODY bgcolor="#FFFFFF" text="#000000" link="#0000FF" alink="#FF0000"
    vlink="#800000">

    If this doesn't fix it, post a URL to a live example.

    If that's not what the book tells you (as in, it wasn't your typo that
    produced the erroneous body tag), throw it away. Far away. It's a litle
    dated anyhow.

    Actually, the modern way to do this would be more along the lines of:

    <html>
    <head>
    <title>This is the title</title>
    <style type="text/css">
    body {
    background-color: #ffffff;
    color: #000000;
    }
    a:link {
    color: #0000ff;
    background-color: inherit;
    }
    a:visited {
    color: #800000;
    background-color: inherit;
    }
    a:active {
    color: #ff0000;
    background-color: inherit;
    }
    </style>
    </head>
    <body>
    --- content ---
    </body>
    </html>

    One more tip - use <p> to start a paragraph, and use </p> to end it. You
    don't need to, it's not required, but it's a good habit to develop for the
    possible future.
     
    Neal, Jul 2, 2004
    #4
  5. Change this to <body> and remember that every tag has a start and an end.

    For example:
    <p>your text here</p> <-- it's important to close most tags this way

    There is no need for the bgcolor, text, link and other items.
    Those attributes (That's what they are called) are wasted space.

    Later, you will use attributes - but not now.

    The Doormouse
     
    The Doormouse, Jul 2, 2004
    #5
  6. Stephen Glynn

    Sid Ismail Guest

    On Fri, 02 Jul 2004 19:31:13 +0100, Stephen Glynn

    : <BODY bgcolor="FFFFFF" text="000000" link = "0000FF" alink="FF0000"
    : vlink="800000>


    Add the close quote, and the first 2 paragraphs reappear quite magically.
    Even David Copperfield will be proud of you!

    Sid
     
    Sid Ismail, Jul 2, 2004
    #6
  7. Stephen Glynn

    Mitja Guest

    A bit unlucky choice...
    Paragraph closing is optional in HTML.
     
    Mitja, Jul 3, 2004
    #7
  8. Stephen Glynn

    Neal Guest

    It's not required, but recommended.
     
    Neal, Jul 3, 2004
    #8
  9. Stephen Glynn

    rf Guest

    The HTML 4.01 spec states that </p> is optional. Please point out where the
    spec says it is recommended.
     
    rf, Jul 3, 2004
    #9
  10. Stephen Glynn

    Neal Guest

    I didn't say the spec says it was recommended. :) I said it's recommended.

    It's recommended by me. :p
     
    Neal, Jul 3, 2004
    #10
  11. Stephen Glynn

    rf Guest

    And your credentials are?

    BTW I agree(a) with you. Closing tags should be used for all elements that
    are not empty. *My* reasoning is:

    1) How does one remember which non-empty HTML 4.x elements require closing
    tags and which do not. It is easier to close all of them.

    2) One of these days we may have to move to XHTML(b) where *all* elements
    are required to be closed. Closing all of them now will make that future
    legacy code easier to bring up to date.

    (a) It is still not "recommended", simply good practice. If you provide the
    above two qualifiers you may be entitled to say "recommended". If you don't
    then you must cite a source for that "recommendation".

    (b) Not likely but a posssibility. After all in 1984 we never would have
    thought that it would be *required* to use 32 bit memory addressing.
     
    rf, Jul 3, 2004
    #11
  12. Stephen Glynn

    Neal Guest

    Simply that I'm smart enough to listen to and learn from those smarter
    than me... and those individuals have shown that it's smart to do this.
    Those are my usual arguments as well. Being that those have been presented
    in this ng often, I figured it was not necessary to repeat.
     
    Neal, Jul 3, 2004
    #12
  13. Unless it were enforced by Big Brother.
     
    Toby A Inkster, Jul 3, 2004
    #13
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.