Wednesday, July 3, 2019

Basic HTML Tags

Headings

Headings are defined with the <h1> to <h6> tags. <h1> defines the largest heading while <h6> defines the smallest.
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This is a heading</h5>
<h6> This is a heading</h6>
HTML automatically adds an extra blank line before and after a heading. A useful heading attribute is align.

<h5 align="left">I can align headings </h5>
<h5 align="center">This is a centered heading </h5>
<h5 align="right">This is a heading aligned to the right </h5>


Paragraphs

Paragraphs are defined with the <p> tag. Think of a paragraph as a block of text. You can use the align attribute with a paragraph tag as well.
<p align="left">This is a paragraph</p>
<p align="center">this is another paragraph</p>
Important:

HTML Elements

Remember the HTML example from the previous page:

<html>
<head>
<title>My First Webpage</title>
</head>
<body>
This is my first homepage. <b>This text is bold</b>
</body>
</html>
This is an HTML element:
<b>This text is bold</b>
The HTML element begins with a start tag: <b>
The content of the HTML element is: This text is bold
The HTML element ends with an end tag: </b>
The purpose of the <b> tag is to define an HTML element that should be displayed as bold.
This is also an HTML element:
<body>
This is my first homepage. <b>This text is bold</b>
</body>
This HTML element starts with the start tag <body>, and ends with the end tag </body>. The purpose of the <body> tag is to define the HTML element that contains the body of the HTML document.

HTML Tags

What are HTML tags?

􀂃 HTML tags are used to mark-up HTML elements
􀂃 HTML tags are surrounded by the two characters < and >
􀂃 The surrounding characters are called angle brackets
􀂃 HTML tags normally come in pairs like <b> and </b>
􀂃 The first tag in a pair is the start tag, the second tag is the end tag
􀂃 The text between the start and end tags is the element content
􀂃 HTML tags are not case sensitive, <b> means the same as <B>


Logical vs. Physical Tags


In HTML there are both logical tags and physical tags. Logical tags are designed to describe (to the browser) the enclosed text's meaning. An example of a logical tag is the <strong> </strong> tag. By placing text in between these tags you are telling the browser that the text has some greater importance. By default all browsers make the text appear bold when in between the <strong> and </strong> tags.
Physical tags on the other hand provide specific instructions on how to display the text they enclose. Examples of physical tags include:
􀂃 <b>: Makes the text bold.
􀂃 <big>: Makes the text usually one size bigger than what's around it.
􀂃 <i>: Makes text italic.
Physical tags were invented to add style to HTML pages because style sheets were not around, though the original intention of HTML was to not have physical tags. Rather than use physical tags to style your HTML pages, you should use style sheets.


HTML - Hyper Text Markup Language

HTML files have a basic structure that you MUST work within. Before you begin the tutorial you should type or copy/paste the following 8 lines from this screen into the text file (file you have open in notepad)

<html>
<head>
<title>MY HOME PAGE NAME</title>
</head>
<body>
THIS IS WHERE THE CODE FOR BODY (WHAT YOU SEE IN NETSCAPE/INTERNET EXPLORER) OF THE WEB PAGE GOES.
</body>

The text/bracket combinations are called tags. Note they come in pairs. There is always a beginning tag (<title>) and an end tag (</title>). The beginning tag signals Netscape / Internet Explorer that a new tag/task is starting. The end tag tells Netscape / Internet Explorer that the tag/task has ended. You will learn more about these in the tutorial. Save the above file to the desk top of your computer as: home.html. Make sure to add the extension ".html" to the end of the file


OPENING THE HTML FILE IN NETSCAPE/INTERNETEXPLORER

Now you can view the results of your work:
1. Go to or open Netscape/Internet Explorer
2. File > Open or Open Page
3. Press the Choose or Browse button
4. Browse to the desktop and double click on home.html
5. Click Open/OK to load the file
If this did not work, ask for help.

Save the file as mypage.html. Start your Internet browser. Select Open (or Open Page) in the File menu of your browser. A dialog box will appear. Select Browse (or Choose File) and locate the html file you just created - mypage.html - select it and click Open. Now you should see an address in the
dialog box, for example C:\MyDocuments\mypage.html. Click OK, and the browser will display the page. To view how the page should look, visit this web page: http://profdevtrain.austincc.edu/html/mypage.html