Hypertext Markup Language is the computer language used for creating documents to be displayed on the Web.
HTML file name examples:
HTML It is a standardized system for tagging text files to achieve font, color, graphic, and hyperlink effects on World Wide Web pages. ~dictionary definition
An HTML document is a text file named with the .html extension. It is made up of tags and text.
Tags are keywords that instruct the browser how to format and display content on the Web.
All tags are enclosed in brackets <>. Most tags must have an opening and a closing part. Examples:
Let’s create our first Web page.
Create a folder on your desktop and name it 'Awesome Website'. This is where you will save all the web pages (and their components) that we will be making throughout the lessons.
Open your editor (Sublime Text) and create a new file.
Save it as home.html (inside the Awesome Website folder)
Now type this up:
Notice that as you are typing, the editor automatically loads up a bunch of lines for you. Don’t delete them, press return instead. You’re lucky you don’t have to type them all up - that prevents syntax typos!
Let’s see what each line means…
The <!DOCTYPE> declaration is not an HTML tag.
It is an instruction to the web browser about what version of HTML the page is written in, so that the browser knows what type of document to expect.
Declaration is NOT case sensitive.
This is the start <html> tag
The <html> element defines the whole document.
The <head> element is a container for all the head elements, which will be explained as we encounter them.
The <head> element can include a title for the document, scripts, styles, meta information, and more.
In HTML5, the <head> element can be omitted.
The <title> tag is required in all HTML documents.
This is the end </head> tag.
This is the start <body> tag.
The <body> element defines the document body.
This is the end </body> tag.
This is the end </html> tag.
Insert this line of text between your title tags:
Awesome Website - Home.
<title>Awesome Website - Home</title>
Awesome Website - Home will now be:
the title that appears in the browser toolbar
the title for the page when it is added to favorites
the title for the page in search-engine results
Time for a heading…
Place your cursor between the <body> </body> tags
Type in <h and you should see a list of suggestions.
Select h1 tag and the editor should give you <h1></h1>
Now type in HTML is Fun inside your h1 tags
It should look like this:
The <h1> to <h6> tags are used to define HTML headings. They give structure to your content; DO NOT use heading tags just to make your text big or bold.
Heading tags are, by default, formatted from largest<h1> to smallest <h6>, and in order of importance. Use them in this hierarchical fashion: nest lower ranks inside higher ranks. Start a new section if you need to use a new high rank. If you need to use another H1, start a new page.
We’ll learn more about this later.
Type in <h again and you should see a list of suggestions again.
Select h2 tag and the editor should give you <h2></h2>
Now type in ...When you have an awesome teacher! inside your h2 tags
Now that the page has some cool headings, let’s build paragraphs...
On the next line, type in <p and select p tag (paragraph tag)
We need some placeholder text, so go to https://loremipsum.io/
Paste that content between the <p> tags and you have a paragraph.
Save your file by hitting control-S or command-S.
Go to your Awesome Website folder
Double-click on home.html.
A browser window or tab should show you your work..
Before we wrap up today’s lesson, let’s give your first web page a nice little styling...
Inside the start <body> tag, type in the letter s and hit the Return key.
Now your page is ready for some style.
Type these declarations inside the quotes.
border: 1px solid gray;
Pretty self-explanatory, but we will be discussing this on our next lesson.
Save your work and refresh your webpage.
Now you have a responsive page. This means that you can size your browser up or down and your page should magically resize!
You can try tweaking your declaration values and see what happens:
border: 10px dotted red;
border: 3px dashed blue;
That’s it for today!
Don’t forget to try the two the post-lesson exercises I will be posting here!