I hope you don't get tired of the text... xDLets start...1. The Basics + TextTo begin an HTML page, start with the HTML tag.
<html></html>The </html> tag closes the page, use at the end.That's everything we have for now, but we need more then just an empty page with no title.Next, the head of the document. Mostly where the data is stored. For now, no data is stored.
<head></head>You must include some tags in the <head> code, others the afflicated script doesn't work.The title of the page (displayed in the title bar of the browser) is inside an <title> tag. To display a title correctly, use the following code:
<html><head><title>(Yourtitlehere)</title></head>We don't close the HTML document, we need more in the document.Next, text.Start the text with an <body> on the document.
Then, put <h#> in it.
Here are the <h#> codes:
<h1>
<h2>
<h3>
<h4>
<h5>
<h6>
Each tag closes with an </h#>.How bigger the number, how smaller the text. Lets put the biggest in our document...
<html><head><title>(Yourtitlehere)</title></head>
<body><h1>This is an example page</h1>This will display This is an example page
on the document, exactly that big. We don't close the body tag, as we still need the body.Next, text under the <h#> tag.
Just type some text, it will display normally, but if we use this:
<html><head><title>(Yourtitlehere)</title></head>
<h1>This is an example page</h1>
Hello, this is an example page.
This doesn't work correct.It will display: ''Hello, this is an example page.This doesn't work correct.''If you press Enter, HTML doesn't recognize it as a letter. That's why the
tag exist.
If we do:
<html><head><title>(Yourtitlehere)</title></head>
<body><h1>This is an example page</h1>
Hello, this is an example page.
This does work correct.It displays this: ''Hello, this is an example page.
This does work correct.''
So works the
tag, but
doesn't require an close!
You now know text, lets go to step 2.2. FormsCreate a form with the <input> tag.
<input>This is an more advanced code, you will need to do several things to make it display something...2.1 - ButtonTo make an button, use this:
<input type=button value="Button">This will display an button with the text ''Button''.Value is what the text on the button will be. You can make it anything, but you must use the "(your text here)".
But, buttons can have another option! You can make them run a script, but that is explained in my JavaScript tutorial.2.2 - Input field
To make an input field, use this:
<input type=text>That is enough. No extra things needed.If you want to make a password field, use this:
<input type=password>That is enough too. This will display big dots when typing your ''password''.2.3 - File uploadIf you want an user upload a file, use this code:
<input type=file>Now the file doesn't have an limit. To make an size limit, use:<input type="hidden" name="max_file_size" value="500">A value of 100 will allow a file up to 100kb.But, how do you upload the file?
Mostly it works to press Enter while having the type-cursor in the file input field.
Now you know how to let the user select a file.2.4 - Radio buttons
To create radio buttons, use:
<input type="radio" name="(yournamehere)">But this will only display a radio button, nothing else.To display text before an button, use:
Hello! Select this <input type="radio" name="selectme">This will display:''Hello! Select this'' with an radio button after it.
Now you learned how to make radio buttons!2.5 - Drop-down menu
To create a drop-down menu, use:
<select>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>You can add more options by the <option> tag.Now you know how to create a drop-down menu.I will continue in my next post.
