W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2017

Re: MY frist html - computer science class student

From: Richard A. O'Keefe <ok@cs.otago.ac.nz>
Date: Tue, 10 Jan 2017 09:00:59 +1300
To: <html-tidy@w3.org>
Message-ID: <0b3e4f4c-1a2a-205c-2376-6a9191dc6ab5@cs.otago.ac.nz>

On 8/01/17 7:20 AM, Jasmine Ramadan wrote:
> hello good morning, I doing an HTML file at a notepad.. in class, we
> learning to code and how to great different types of HTMLlike Table and
> basic HTML storyboard for web page. however, i have trouble with the
> class. Can plz help can u correct my HTML

This is the mailing list for discussing the HTML Tidy program.
You will find HTML Tidy to be a great help in finding issues in
your HTML, and it will automatically try to fix them, but like
any program, it will not guess your intentions perfectly.

> <html>
> <title> Teen fasion for the streets </title>

(1) Just because it's HTML doesn't mean you shouldn't try
to get the spelling of your text right.  s/fasion/fashion/

(2) A <title> element must be inside a <head> element but
you have no <head> tag.  Add <head> after <html> and
before <title>.

> body  { background-color pink ;
> }

(3) That is not HTML.  That is CSS.  You need a <style>
tag BEFORE this line, and a </style> tag AFTER it.
Actually, it's not legal CSS either.  CSS has a
colon between an attribute and its value.

body { background-color: pink; }
> < style >

(4) There is no style information after your <style>
tag and there is no </style> end-tag to close it.
See above.
> <h1>swag clothing for teen </h1>

(5) An <h1> element must be inside a <body> element
and you haven't closed the <head>.  You want
just before this line.

(6) Point of English grammar:  that would have to be
"Swag clothing for a teen" or "Swag clothing for teens".

> <body>

(7) You cannot have a <body> tag after the body has
already begun.

At this point I'm stopping, because two major issues
have become clear.

HTML is *structured* text.  The *way* it is structured
is by using "elements" enclosed in <thing>...</thing>
tags, and using the spatial relationships
before ... after and inside ... outside.
For example, <title> must be inside <head> which
must be inside <html> and <h1> must be inside
<body> which must be after <head>.

You *CAN'T* just slap down tags any old where and expect
the result to make sense.  You MUST respect before-after
and inside-outside.  (As it happens, these are things
that HTML Tidy is particularly good at noticing when you
get them wrong.)

It is up to you to learn, for each element you use,
  - what does this element MEAN?
  - what parts does this element have INSIDE?
  - what kind of element must this be INSIDE?
  - must this element occur in a particular before-after ORDER?

> <table>
> <colgroup>
>   <col span="2"style="background-color:yellow">
>   <col style="background-color:blue>
> </colgroup>
> </tr>

Oh heck, I can't pass this up.  You have a </tr> with no
preceding <tr> .  Why?

Try to get into the habit of never writing a </thing>
tag by itself, but of writing <thing>
</thing> and then filling in what goes between them.

One last suggestion.  Don't write HTML in Notepad
unless your course requires it of you.  (But what
ethical course would force you to use bad tools?)
Get an HTML editor.  There's a free editor called
Brackets you can download from brackets.io ; there
are plenty of others but that's the one I know of.
Received on Monday, 9 January 2017 20:01:50 UTC

This archive was generated by hypermail 2.3.1 : Monday, 20 February 2017 16:52:06 UTC