Post by Luco El Loco on Nov 24, 2005 17:54:43 GMT
We all need a little help sometimes...
A Basic Web-Page
Lesson 1: Heads and Bodies
The basics are incredibly simple and learning a little at a time you can soon master a simple page.
Web pages use a language known as html. The site W3 Schools explains:
What is an HTML File?
HTML stands for Hyper Text Markup Language
An HTML file is a text file containing small markup tags
The markup tags tell the Web browser how to display the page
An HTML file must have an htm or html file extension
An HTML file can be created using a simple text editor
HTML stands for Hyper Text Markup Language
An HTML file is a text file containing small markup tags
The markup tags tell the Web browser how to display the page
An HTML file must have an htm or html file extension
An HTML file can be created using a simple text editor
Therefore, all you need is a simple text editor, such as Notepad.
Notepad at the ready?
Alternatively Mac users can use SimpleText.
Good. Now look at the code below.
<html>
<head>
<title>Title of page</title>
</head>
<body>
This is my first webpage.
</body>
</html>
<head>
<title>Title of page</title>
</head>
<body>
This is my first webpage.
</body>
</html>
You must start with an open tag such as <html>, which is the first one you would use anyway. That one also ends the page so you close it by adding a '/' in the pointy bracket. The <html> tag tells your browser that that is the start of the document, and the </html> tag tells your browser that that is the end of it. Other tags function in the same way. The title, the body, and other tags all open and close in the same way.
The title part will place a title on your title bar, and the text in the body section is the main page area.
Always open your text with an open tag and close your text at the end.
To keep the file so that it is editable save it as a txt file, but if you wish to view what it looks like then also save it as a htm page. Then to view it, start your internet browser and choose open and find the file on your computer. The browser should display your page in all its glory.
Lesson 2: Adding Elements and Attributes
An element tells your browser to display something in a particular way. For example, you can make your text centralised:
<center>This text is centralised.</center>
As you can see, elements start with an open tag and closes like with the main tags we looked at earlier.
You can also:
<body><b>make text bold</b>
<i>make text italicised</i>
<u>and underlined</u></body>
Tags can have attributes, such as colour. Your page will need a background. For example you can specify:
<body bgcolor="blue">
Usually you will be using hex codes which are number and letter combinations ascribed to various colours. A good colour chart site is: www.hypersolutions.org/pages/rgbhex.html
To input a hex code instead of a word then you simply type in the relevant hex code in the quotes.
Another cool little trick to introduce at this point is the <br> tag which breaks up your text with spaces. You add as many <br> tags as you need to make a horizontal space. This does not require a close tag though as you're not opening anything - just telling the browser that there is space. So if you want two lines worth of space between some text, you add <br><br>.
That will be all for today, but I will be back with more in part 3 explaining how to add images and other basics.