Unit 1 - HTML Structure & Syntax
Let's start with the very basics. Want to follow along and try out some of the coding? Go to
this free live HTML coder to get interactive
feedback.
<b>
Above is an example of a Hypertext Mark Up Language (HTML) tag. Tags must be surrounded by < and >. The first arrow tells the webpage that the tag has begun, and anything after it is coding. The tag must
be ended when finished with the second arrow. If you do not, the computer will think that words you put after are not part of the coding.
1. <b random word>
2. <fo>nt
One is an example of "random word" showing up as part of the code because the ending arrow wasn't added.
Two is an example of the command for "font" being cut off because the ending arrow begins too early.
Be aware that both of those mistakes will break your code. It will look strange!
Now that we have
<b>
, we can put some words after it. Once we finish our word, sentence, or paragraph, we put the end tag which is the same as the start tag
but with a / after the first arrow.
<b>Words</b>
The same goes for any other tag whether the tag makes words bold, italic, or makes a blue box (boxes are in the DIV/SPAN unit).
Now that you know about tags, you must learn how to set up a HTML page. This does not mean you have to have a file on your computer because websites offer coding for customization.
Before I continue, using a live HTML editor is fine for beginners, although if you think you'll be invested into coding and want a more organized experience, I highly suggest downloading
a free website coding software such as Visual Studio Code which will color code for you, keep files organized, and auto-save work. On a website coding software, you will have to look up
the tutorial for the certain software you're using to learn its interface and features. Within the software, you will make a HTML document by naming it something such as website.html.
Only one file is needed for simple coding and I will go further into why you would need multiple HTML files in Unit 6.
This is the bare minimum you will need:
1. <!doctype html>
2. <html>
3. <head>
4. <title>Your Site title</title>
5. </head>
6. <body>
7. Words & Content
8. </body>
9. </html>
I suggest putting an indent on certain tags to keep things easier to read as having everything on the same vertical line can get confusing.
I have added a number before each line to make it easy for reference to the coding. On line 3 is the head. This is where you put your site title (the tab title), your stylesheets (Unit 4),
different stylesheets for coding (Unit 6), as well as the favicon, which is the small icon that shows up on the tab.
Below is the heading of a site I coded:
1. <head>
2. <script data-ad-client="ca-pub-4880664155319472" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
3. <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
4. <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
5. <!--BootStrap-->
6. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
7. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
8. <!--Icons-->
9. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
10. <script src='https://kit.fontawesome.com/a076d05399.js'></script>
11. <!--Custom-->
12. <link rel="stylesheet" type="text/css" href="EtherealCSS.css">
13. <script type="text/javascript" src="EtherealJS.js"></script>
14. <!--Favicon-->
15. <link rel="apple-touch-icon" sizes="180x180" href="favicon_io/apple-touch-icon.png">
16. <link rel="icon" type="image/png" sizes="32x32" href="favicon_io/favicon-32x32.png">
17. <link rel="icon" type="image/png" sizes="16x16" href="favicon_io/favicon-16x16.png">
18. </head>
You may have noticed <!--BootStrap-->. This is an HTML comment which allows you to label coding and stay organized for yourself and/or others. A HTML comment can span one line
or be on multiple lines. Below is an example of a comment spanning multiple lines. In these comments, you can put coding as well as text. As long as the coding is inclosed within the
comment's beginning and end tag, the coding you put within the comment will be nullified. Comments will be visible within the raw code but not in the resulting website and often look
faded in color.
<!--
First line
Second line
-->