1. What is an HTML file?
- HTML refers to the hypertext tag language.
- HTML files are text files that contain tags.
- These labels tell the web browser how to display pages.
- HTML files must use HTM or HTML as the file extension.
- HTML files can be created using a simple text editor.
Ii. First Experiment
Create a new notepad, enter the text, and save it as "mypage.htm ".
<HTML>
<Head>
<Title> title of page </title>
</Head>
<Body>
This is my first homepage. <B> This text is bold </B>
</Body>
</Html>
Open it in IE browser and run the result: This is my first homepage.This text is bold
Example:
The first tag in the HTML file is <HTML>. This tag tells the browser the starting point of the HTML file. The last tag in the file is
The text between the
<Title> the text in the tag is the file title. The title is displayed in the title bar of the browser.
<Body> the text in the tag is the text displayed by the browser.
The text in the <B> and </B> labels is displayed in bold.
3. HTML elements
HTML TagCase Insensitive, <B> and <B> have the same effect.
Paragraphs and results:
<HTML>
<Body>
<P> This is a paragraph. </P>
<P> This is a paragraph. </P>
<P> This is a paragraph. </P>
<P> paragraph elements are defined by the P tag. </P>
</Body>
</Html>
This is a paragraph.
This is a paragraph.
This is a paragraph.
Paragraph elements are defined by the P tag.
Title and result:
<H1> This is a heading <H2> This is a heading </H2>
<H3> This is a heading <H4> This is a heading </H4>
<H5> This is a heading </H5>
<H6> This is a heading </H6>
This is a heading
...
This is a heading
Line Break (line break)
When you want to end a row and do not want to start a new paragraph, the <br> label will be used. No matter where you place it, the <br> label will generate a forced line feed.
<p>This <br>
is a para<br>
graph with line breaks</p>
<Br> A tag is a blank tag. Because closing a tag does not make any sense, it does not have a termination tag similar to </BR>.
This
Is a Para
Graph with line breaks
HTML comment
The comment tag is used to insert comments in the HTML source code. The comment is ignored by the browser. You can use annotations to explain your code. This will help you edit your code in the future.
<!-- This is a comment -->
Note: You need to write an exclamation point after the left bracket, which is not required before the right bracket.
Basic HTML tags
Tag |
Description |
<HTML> |
Define HTML documents. |
<Body> |
Define the document subject. |
<H1> to <H6> |
Define Titles 1 to 6. |
<P> |
Define a paragraph. |
<Br> |
Insert a line. |
<HR> |
Define a horizontal line. |
<! --> |
Define comments. |