billcummings wrote:So by -----(oh darn it, now I’m starting sentences with, “So.”) clicking “Show Source,” I could teach myself how everyone is doing it. (?)
Yup. But I have to warn you that most web pages in these modern times are generated by machines that spew out all kinds of gobbletygook that's hard to make heads or tails from. It'll scare you right off!!
For example, if you show the "source" of this page you're reading, it'll be so full of HTML tags that you won't hardly recognize anything on the page at all.
So to make it easier, open up a new browser window and go to
http://torreyhawks.org. Then use "Show Source" on that page. That's a nice simple page that I wrote about 7 years ago when we founded the Torrey Hawks (we've stayed pretty true to our founding principles all these years). Here's what it looks like:
<html>
<body bgcolor="#a0b7d0">
<center><img src="homepage.jpg"></center>
<hr>
<center>
<h2>
<b>
The Torrey Hawks Hang Gliding Club is dedicated to promoting and<br>
protecting the sport of Hang Gliding at the Torrey Pines Gliderport.
</b>
</h2>
</center>
<hr>
<p>
<ul>
<h3>
<li><a href="ABOUT.HTM">Mission Statement and By-Laws</a><p>
<li><a href="http://ushawks.org/forum/viewforum.php?f=4">Torrey Hawks Club Forum</a><p>
<li><a href="HIST.HTM">Historical Photos from 1977 and 1986</a><p>
<li><a href="TOUR.HTM">Flying Tour of the Torrey Pines Coastline from May 5, 2006</a><p>
<li><a href="founder/founder.htm">Founder's Page</a><p>
<li><a href="INDEX.HTM">Contact: (858) 204-7499</a> - or - <a href="mailto:bobkuczewski@gmail.com">bobkuczewski@gmail.com</a><p>
</ul>
</h3>
</ul>
</body>
</html>
You'll see that the page starts and ends with an "html" tag that tells the browser that ... it's an HTML page!!
Then it has a "body" tag that includes a background color (bgolor="#a0b7d0"). That's what makes the background blue. If you change those numbers you'll get different colors.
After that, there's an image file named "homepage.jpg" shown centered with an "img" tag ("img" is how they write "image" when they're trying to save two keystrokes
). That particular image shows our Torrey Hawks logo.
Then there a "Horizontal Rule" (hr) and a "heading 2" (h2 - no that's not a hang gliding rating).
The site description is enclosed in "Bold" (b) tags and has a "break" (br) to split it just where I wanted.
A little further down, there's an "Unordered List" (ul) which is a list that uses "bullets" instead of numbers.
Within the list everything is "heading 3" (h3 - not a hang gliding rating either).
And then within the list are a bunch of "List Items" (li) and "Anchors" (a href=) which make links to other web pages and web sites.
Finally, there's a bunch of "closing" tags that match the opening tags. Just like in BBCode, HTML closing tags have a leading "/" inside the brackets.
So there's a quick intro to HTML (Hyper Text Markup Language).
billcummings wrote:Years ago a tech. guy told me there is a program that once you are done you can submit it to see if the code meets normal standards. How does one do that?
There are a number of programs (and web sites) that can do that, so I don't know which one he mentioned. I typically try to keep things pretty simple, and then it works on almost all web browsers. I think the Torrey Hawks web site would look just fine in Windows 3.1 (if anyone can remember that far back). The more new nifty features you put in your web pages, the fewer browsers are capable of showing them properly.
By the way, while I was typing this, I decided to create a Java program that lets you type HTML in one window and see how it's displayed in another window. Here's what that program looks like when it's running:
- HTML_Editor.png (187.23 KiB) Viewed 7327 times
And here's the Java program that does that:
- Code: Select all
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
public class HTML_Editor extends JFrame implements KeyListener{
JTextArea t;
JEditorPane p;
HTML_Editor(String title, String[] args) {
setSize(800,600);
setTitle(title);
String content = "<html>\n<body>\n<h1>Hello HTML!!</h1>\n</body>\n</html>";
this.t = new JTextArea();
this.t.addKeyListener ( this );
this.t.setText ( content );
this.p = new JEditorPane();
this.p.setContentType ( "text/html" );
this.p.setText ( content );
JSplitPane panels = new JSplitPane ( JSplitPane.HORIZONTAL_SPLIT, true, this.t, this.p );
panels.setDividerLocation ( 0.5 );
this.add ( panels );
this.setVisible(true);
this.addKeyListener ( this );
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void copy_text() {
this.p.setText ( this.t.getText() );
}
public void keyPressed(KeyEvent e) {
copy_text();
}
public void keyReleased(KeyEvent e) {
copy_text();
}
public void keyTyped(KeyEvent e) {
copy_text();
}
public static void main(String[] args) {
HTML_Editor editor = new HTML_Editor ( "HTML Editor", args );
}
}