Wednesday, 4 February 2015

Post 2 Regarding Part 1 of HTML

Now I will let you put something before your opening <html> tag. Didn't take me long did it? I also won't tell you to put anything else here at all!
To tell your browser, the browsers of people reading your page and W3C that your page will have standards, we need to add a special line in:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
All you need to know for now is that there are varying levels of "standards" from quite lenient to very strict. We will be going "Middle-ground" for now and using the "Transitional" standards.
The other thing to explain is that HTML itself is updated and changed over time so the "4.01" is the standards we are using. If it is deemed necessary, as the standards and capabilities of HTML change, these tutorials will also be updated.

So place that line above your <html> tag. Always have this line when you start any new HTML page.

<html><head>
<script language="JavaScript">
function bgChange(bg)
{    document.body.style.background=bg; }
</script></head>
<body><b>Mouse over these table cells, and the background color will change</b>
<table width="300" height="100">
 <tr>
  <td onmouseover="bgChange('red')"
    onmouseout="bgChange('transparent')" bgcolor="red">
  </td>
  <td onmouseover="bgChange('blue')"
    onmouseout="bgChange('transparent')" bgcolor="blue">
  </td>
  <td onmouseover="bgChange('green')"
    onmouseout="bgChange('transparent')" bgcolor=green>
  </td>
</tr>
</table>
</body></html>
With Java Script
Output:

Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title>My first HTML page</title>
 </head>
 <body>
  <h1>Hello World!</h1>
  <p>
   Welcome to my first web page!
  </p>
  <p>
   I will add more stuff when I know how - thanks for stopping by!
  </p>
 </body>
</html>

No comments:

Post a Comment