PDA

View Full Version : Basic HTML Tutorial


Arsenal
11-11-2008, 10:52 PM
Welcome to my Basics of HTML Tutorial!
Here you shall learn what is needed to learn the basics of the web language HTML. But before we start,
What is HTML exactly?
Html stands for Hypertext Mark-up Language and is the programming language used to create documents for display information around the WWW(World Wide Web).

Now that we've gotten that sorted, we can start on the very first lesson.
Purpose: To teach new coders the basics of the web language, HTML.
Difficulty: 2.5. It all depends on how wiling you are to learn it and how much time you put into it.
Requirements: Notepad(You can use programs such as Microsoft FrontPage and Dreamweaver as well), Common knowledge on how to read and follow instructions.

Epilogue:
MAKE SURE YOU ALWAYS PUT THIS BEFORE <HTML>!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">This just tells the browser what the hell you are doing.

Step 1:
First step, guessing that you don't have Frontpage or Dreamweaver, open up notepad and enter the following code into it.

<html>
<body>
This is where your information will go.
</body>
</html>
Each one of these are called a "Tag". There are opening tags < > and closing tags < / > . Each tag must have a closing tag to finish the line of information.

Now that you know what a tag is, we can move on and tell you what each one means.
<html> Is the opening tag that starts everything off and everything between that and the </html> closing tag, is a HTML document.
The stuff between <body> and </body> is the main content of the document and everything between it, will be displayed on the web page.
The </html> and </body> are their respective tags. By this I mean they close your opening tags, <html> and <body> Each opening tag MUST have a closing tag and vice versa.
BUT not all tags have closing tags(by this I mean, example, <html></html>)! Some tags that don't wrap around content, will automatically close themselves. A tag that does this is the line-break tag that looks like this <br /> I'll cover what that tag does later in following tutorials/steps.

Attributes and Elements
Tags(< >) can have attributes which is extra bits of information. They will always appear inside an opening tag and the value will always be in quotation marks(""). Example; <tag attribute="value">HELLO!</tag>

Elements are the bits that make up a web-page. Example; Everything between <body> and </body> is the body element of that page. There are many more examples, <title>Title</title> Between the Title tags, would be the Title element. If you need further assistance with this area, contact me.

Page Titles
You might be going, "What do you mean by page title?" By page title, I mean. Where ever you have a Tab open, see where it has, example; Dodian Forums - Powered by ... On the tag? That is what the page title is. So to make a page title we need to do the following. In your notepad, replace it with this code.
<html>

<head>
<title>Your Title Here</title>
</head>

<body>
Information Here
</body>

</html> Where we have now declared a title for our site. You might now look at it and go, "What does <head></head> mean?" <Head></head> just means anything the appears before the <body></body> element and contains information about the page you're on. You will also (usually) link your site to the CSS file you are using. I will go into more detail later.
<Title></Title> Means exactly what I stated in the opening sentence of this topic. It displays the information about the page and what ever you have in the <title></title> elements, will appear in the title of the bar window.

Paragraphs
In your notepad, add another line below the first line.
<html>

<head>
<title>Title</title>
</head>

<body>
Information Here.
Second Line Here.
</body>

</html> Because your browser doesn't know that you want the information on different lines, you're going to have to do this if you do.
<p>Information here</p>
<p>Second Line Here.</p>
What we have just done is started a new paragraph for both. <p></p> are the paragraph tags and are used to start a new paragraph of information, etc.
Since you have changed them so that they've got the paragraph tags, they will now appear on different lines.

Making the text, Bold or italics!
Ok you might be wondering, "I want my text in bold or in italics, how do I do this?"
To make your text in bold, all you have to do, is simple wrap any content around with one of the following tags, <b></b>, <em></em>, <strong></strong>. Each one of those tags will turn any information or content BOLD!

To make your text in italics, you just simple wrap any given content with the following tag. <i></i> This tag will turn any content into italics!

Line-Break
As stated earlier in the tutorial, there was a tag that didn't need to have a closing tag because it closed itself. Well now it is time to explain what the <br /> tag does!
The <br /> tag is another way to separate content onto different lines and that is why it is called, the 'Line-Break' tag. You might also be wondering "But how does it close itself?"
It closes itself by having the "/" after the letters "br." <br /> Since it does not wrap itself around content. You will use the <br /> tag at the end of a sentence or line to declare that a new line has been started.

Headings!
There are different types of headers, <H1>, H2,H3,H4,H5 and H6. H6 being the smallest and H1 being the largest. Remember, they all have closing tags, </h1></h2> etc.
To make a text or content into a header, you need to wrap it around with the header you want, so add this into your notepad.
<html>

<head>
<title>Title</title>
</head>

<body>
<h1>Header 1</h1>

<h2>Header 2.</h2>
<p>Paragraph</p>

<h2>Header 2</h2>
<p>Info.</p>
</body>

</html> You should only use H1 once as it is meant to be the main heading of the page. H2-H6 can be used as much as you want.


Lists
There are two basic types of lists. There is the un-ordered list and then there is the ordered list. Ordered lists are declared by using the tag <ol></ol> whilst un-ordered lists use <ul></ul>. Within lists, you will always use <li></li> to tell the document, that that sentence, line, word, phrase, etc, is apart of the list and is inside of it.
Replace your HTML document with this.
<html>

<head>
<title>Title</title>
</head>

<body>
<h1>Header 1</h1>

<h2>Header 2.</h2>
<p>Paragraph</p>

<h2>Header 2</h2>
<p>Info.</p>
<ul>
<li>First point.</li>
<li>This is an un-ordered list.</li>
<li>I love Arsenal. =]</li>
</ul>
</body>

</html>As you can see, un-ordered lists have bullet points. You can also have more then one type of lists within a list. Copy and paste this code below, replacing your current document.
<html>

<head>
<title>Title</title>
</head>

<body>
<h1>Header 1</h1>

<h2>Header 2.</h2>
<p>Paragraph</p>

<h2>Header 2</h2>
<p>Info.</p>
<ul>
<li>Lists</li>
<li>
I win.
<ol>
<li>Nice.</li>
<li>As you can see, the ordered list, has numbers.</li>
<li>I AM A BANANA!</li>
<li>My spoon is too big.</li>
</ol>
</li>
<li>Oh wow.</li>
</ul>

</body>

</html>As you can see, lists are quite simple. There are a few more types of lists, but they will be explained through-out my other tutorials.


Continued on next post.

Arsenal
11-12-2008, 01:34 AM
Links and Images
Ok. You might be going, "How do I make images and links appear on my site?" Well this section will tell you how to add them!
First up, LINKS!
Replace your HTML document with this.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>

<head>
<title>Title</title>
</head>

<body>
<h1>Header 1</h1>

<h2>Header 2.</h2>
<p>Paragraph</p>

<h2>Header 2</h2>
<p>Info.</p>
<ul>
<li>Lists</li>
<li>
I win.
<ol>
<li>Nice.</li>
<li>As you can see, the ordered list, has numbers.</li>
<li>I AM A BANANA!</li>
<li>My spoon is too big.</li>
</ol>
</li>
<li>Oh wow.</li>
</ul>
<p><a href="http://www.dodian.com">Dodian</a></p>
</body>

</html><a href="http://www.dodian.com">Dodian</a>
The <a....></a> Are the anchor tags. The anchor tags are used to define a link. Anchor tags can not tell you a link all on their own, they need the destination of the link as well.

The 'href' defines the destination of the link. The <a....></a> Are the anchor tags. The anchor tags are used to define a link. Anchor tags can not tell you a link all on their own, they need the destination of the link as well.
Your link does not have to go to another URL. Say you had another page that you wanted the link to go to. You would simply change the link to this.
<a href="nameofyourfile.html">What ever. =]</a>What we have done here is told the link, to search for the file 'nameofyourfile.html' You would do this when you are uploading one or more .html files onto a webhost, and you want them all to be apart of the same site.

One bad point about the <a> anchor tag, is that when you click on the link, you will be re-directed to that link, on a new page! This can become a "hassle."

Images!
To make an image display on your document, put thise code in.
(We will use google's logo for this part. Google's logo is copyrighted to them and is a registered trade mark of Google.)
<img src="http://www.google.com.au/intl/en_au/images/logo.gif" width="276" height="110" alt="Google's Logo." />
The 'src' is used to tell the browser, where to find the image. You might be going, "Why did you add 'width and height'?" The width and height are not required but SHOULD be added to an image. Why? Because without them, the browser will tend to try and alculate the size of the image on its own and might make it too big, or too small for your liking.

The 'alt' attribute is the alternative description. It is used to display a word, sentence or phrase for those people who can not view an image. It will also appear if no image URL has been added. This attribute is required in the latest version(s) of HTML.
The image tag is similar to the <br /> tag. See how it doesn't have a closing tag? That is because it closes itself by ending with "/>", just like the line-break tag.


Tables
In this section, I will teach you on how to do tables!
Here is a basic, 3x4table.


<table>
<tr>
<td>Row 1, cell 1</td>
<td>Row 1, cell 2</td>
<td>Row 1, cell 3</td>
</tr>
<tr>
<td>Row 2, cell 1</td>
<td>Row 2, cell 2</td>
<td>Row 2, cell 3</td>
</tr>
<tr>
<td>Row 3, cell 1</td>
<td>Row 3, cell 2</td>
<td>Row 3, cell 3</td>
</tr>
<tr>
<td>Row 4, cell 1</td>
<td>Row 4, cell 2</td>
<td>Row 4, cell 3</td>
</tr>
</table>
The <table></table> tags, define that what ever within them, is a table element.
The <tr></tr> tags define a table row. So anything eithin them, is a table row.
The <td></td> tags defines a data cell (the information in that block). The <td></td> tags MUST be within the <tr></tr> tags.
You can have as many rows, data cells as you want. =]
Make sure your table goes within the <body></body> tags.

Forms
In this section, I will be teaching you the basics of forms.
To be continued.........


THIS IS TO BE CONTINUED! I'M BUSY SO I THOUGHT I'D POST WHAT I HAVE SO FAR! THIS IS ALL DONE BY ARSENAL94! IF YOU SEE LEACHED, TELL ME!
MAKE SURE YOU SAVE IT AS A .HTML FILE!

Brains
11-12-2008, 01:49 AM
Lol? <title></title> have to be inside <head></head>. So then it knows that it is before the main content of the page. Also, WTF? Lol. You just made everything on one line. XD
It all does the same thing. <title> is <title> no matter where you put it as long as it is before <body> :) And yes one line per tag is how i type.

Arsenal
11-12-2008, 01:53 AM
It all does the same thing. <title> is <title> no matter where you put it as long as it is before <body> :) And yes one line per tag is how i type.
Must coders(professinals) will put it in <head> Also, it is a lot easier to put your opening tags and closing tags, all on one line. But do what ever you want.

Dangt351
11-12-2008, 02:00 AM
Great Job Arsenal, Should help tons of people out.

~Dangt351

Gravediggah
11-12-2008, 04:43 PM
Must coders(professinals) will put it in <head> Also, it is a lot easier to put your opening tags and closing tags, all on one line. But do what ever you want.

As correct notation, you NEED to put <title></title> between <head> and </head>. Else it's not valid HTML.

Arsenal
11-12-2008, 04:45 PM
As correct notation, you NEED to put <title></title> between <head> and </head>. Else it's not valid HTML.
You don't have to. <title></title> Will work outside of the <head> tags. It just makes it easier for the document to read it, and is the correct way to use the tags.

Boylight
11-12-2008, 04:49 PM
Thanks Aussie,it will be used.

Gravediggah
11-13-2008, 05:31 PM
Thats not what he said; it may work outside of the head tags but it will not be valid html.


Indeed, that's what I meant :)

Nottz
11-13-2008, 05:33 PM
We should combine our guides.

N I C K
11-13-2008, 05:37 PM
God, Dodian people are smart. How long did this take?

Arsenal
11-13-2008, 05:44 PM
Thats not what he said; it may work outside of the head tags but it will not be valid html.
I know. I just CBF to inclued it. Lol.

God, Dodian people are smart. How long did this take?
HTML takes around 12seconds to learn. Lol. I'll get into forms later.

N I C K
11-13-2008, 05:46 PM
Ha....Maybe for you it did.

Arsenal
11-13-2008, 06:02 PM
Ha....Maybe for you it did.
Trust me. Learning HTML is easy. HTML, XML, CSS and JavaScript, are the easiest coding languages known to man. If you learn XML, you learn HTML. If you learn HTML, you'll learn CSS and JavaScript along the way. You can cover them all within a week or less of setting your mind to it and trying to learn it! =]

evelstar7
11-23-2008, 07:19 PM
well atlest somone did it i cba to lol i mean looking how long it is

JavaQuestion
11-25-2008, 02:53 AM
Trust me. Learning HTML is easy. HTML, XML, CSS and JavaScript, are the easiest coding languages known to man. If you learn XML, you learn HTML. If you learn HTML, you'll learn CSS and JavaScript along the way. You can cover them all within a week or less of setting your mind to it and trying to learn it! =]

Exactly,It is easy.

mibbit
12-20-2008, 09:51 AM
i use free programing for my graphics on for my friends( i hate making them)

evelstar7
12-20-2008, 03:16 PM
nice this will help a lil thanks

D I N O
12-22-2008, 08:41 PM
Very good HTML guide, how long did this take to create?

Arsenal
12-22-2008, 08:43 PM
Very good HTML guide, how long did this take to create?
Not to long. I'm just too lazy and don't have enough time to explain forms. Lol.

D I N O
12-22-2008, 08:49 PM
Fair Enough :) Still Good Work, Arsenal94, Keep up the good work bro!

~D I N O

gunhaven
01-01-2009, 02:07 AM
tyvm this tut was very helpful A+:)