views
Learning Basic HTML
Open an HTML document. Most text editing programs, including Notepad or Notepad++ for Windows, TextEdit for Mac, and gedit for GNU/Linux can be used to write HTML documents. Open a new document and use File → Save As in the top menu to save it as a "Web Page," or to change the file extension to ".html" instead of ".doc," ".rtf," or any other extension. You may see a warning that your document will be changed to "plain text" instead of "rich text," or that special formatting and images won't be saved properly. This is fine; HTML documents do not use those options.
View your document with an internet browser. Save your blank document, then find the document icon in your computer and double click to open it. It should open as a blank web page in your browser. If it doesn't, drag the file icon to the URL (address) bar of your browser. As you edit your HTML document in this tutorial, you can keep checking back and seeing how your web page changes. Note that this does not actually create a website online. It will not be accessible by other people, and you do not need an internet connection to test out. This just uses a browser to "read" your HTML document as though it were a website.
Understand markup tags. Markup tags do not show up on a web page like normal text. Instead, they tell your web browser how to display the page and its content. The "start tag" contains instructions. For example, it might tell the browser to display text as bold. You also need an "end tag" to let the browser know where the instructions apply: in this example, all text between the start tag and the end tag will be bold. Write end tags inside angle brackets as well, but start with a slash after the first bracket.
Write start tags in between angle brackets:
Write your first tag. Every html document starts with a tag and ends with a tag. This tells the browser that everything between these tags is in HTML. Add these tags to your document: Often, HTML files are started with a line that indicates that the file as a whole should be read as a HTML file by browsers. It isn't needed, but may help resolve compatibility issues. Write at the top of your document. Hit enter or return several times to give yourself some space, then write Remember to write everything else in this tutorial in between these two tags.
Fill out the
portion of your document. In between the and tags, write a start tag and a end tag. Give yourself space to write between them. Everything in between these head tags won't actually be displayed on the page itself. Try the following and see where it shows up instead: In between the and tags, writeCreate a
section. Everything else in this beginner document will go in a body section, which actually gets displayed on the web page. After the end tag, but before the tag, write and . For the rest of this tutorial, everything you write will go in between these body tags. You should now have a document that looks like this:Add text in various styles. Now it's time to write something you can actually see in your browser! Anything you write within the body tags will show up in your browser after you save the HTML document and refresh the browser page. Don't write anything with the < or > symbols, however, since your browser will try to interpret it as an HTML instruction instead of normal text. Try writing Hello world! (or anything else you like), then add these new tags around it and see what happens each time:
Hello world! will show up as "emphasized text:" Hello world!
Hello world! will show up as "strong text:" Hello world!
Hello world! will show up with a strikethrough: Hello world!
Hello world! will show up as superscript:
Hello world! will show up as subscript: Hello world!
Try combinations of these: What does Hello world! look like?
Divide your text into paragraphs. If you try to write several lines of text in your HTML document, you might notice that the line breaks don't show up in your browser. You have to code these in yourself:
This is a separate paragraph.
This sentence is followed by a line break.before this sentence begins.This is the first tag you've seen that doesn't need an end tag! These are called "empty tags." Make headings to display the names of sections:
header text
: the largest headerheader text
(the 2 level header)header text
(the 3 level header)header text
(the 4 level header)header text
(the smallest header)Learn how to make lists. There are several different ways to write lists on your webpage. Try out the following types of code and see which one you like. Note that one pair of tags goes around the whole list (such as the
- and
- One item
- Another item
- Another item
- Item 1
- Item 2
- Item 3
- Coffee
- - Hot Beverage
- Leite
- - Cold Beverage
Spruce up your page with line breaks, horizontal lines, and images. Now it's time to try adding things besides text to your page. Try out the following tags, or click the links for more information. You'll need to use an online image hosting service so you have a URL to link to in the image tag:
Insert a Line in HTML:
or
Add images:
Link to other places on the page. You can also use this code to link to other pages and websites, but for now, since you may not have a web site yet, we'll focus on "anchors," or specific places on the page that you can link to:
First make an anchor with the tag at the point on the page that you want to link to. Name it something descriptive and easy to remember.:This is the text you put the anchor around.https://www.youtube.com/watch?v=UB1O30fR-EE 4 times
Use the
Learning More Advanced HTML
Learn about attributes. Attributes are placed within the tag itself, making additional alterations to the "element content" between the start and end tag. They never stand alone. They are written in the format name="value", where name is the name of the attribute (for instance "color"), and value describes this specific instance (for instance "red"). You've actually seen attributes before, if you followed the tutorial in the basic HTML section. tags use the src attribute, anchors use the name attribute, and links use the href attribute. See how those all follow the ___="___" format?
Experiment with HTML tables. Making a table, or chart, requires several different tags. Play with these tags, or learn about HTML tables in more detail. Start with table tags around the entire table:
Column 1: Month | Column 2: Money Saved |
---|---|
January | $100 |
Learn the miscellaneous head tags. You've already learned the
tag, which shows up at the start of each document. Besides the