HTML Elements


  • An element consists of three basic parts: an opening tag, the element’s content, and finally, a closing tag. For Example :
    1. <body> – opening paragraph tag
    2. Element Content – paragraph words
    3. </body> – closing tag

    Every webpage requires four critical elements : html, head, title, and body elements .

<html> ……..</html>

The first tag in your HTML document is <html>. This is called starting html document. The last tag in your document is </html>. This is called end of the HTML document.

<head> ……..</head>

The text between the <head> tag and the </head> tag is header information. Header information is not displayed in the browser window.

<title> ……..</title>

The text between the <title> tags is the title of your document. The title is displayed in your browser’s caption.

<body> ……..</body>

The text between the <body> tags is the text that will be displayed in your browser. Inset the body tag you can use following attributes like bgcolor, background <body bgcolor=”red”> <body background=”test.jpg”>

How to create html file?

If you are running Windows, start Notepad. If you are on a Mac, start SimpleText. In OSX start TextEdit and change the following preferences: Open the “Format” menu and select “Plain text” instead of “Rich text”. Then open the “Preferences” window under the “Text Edit” menu and select “Ignore rich text commands in HTML files”. Your HTML code will probably not work if you do not change the preferences above! Type in the following text:

HTML code : <html> <head> <title> My Personal web page! </title> </head> <body bgcolor=”red”> My frist web page example! </body> </html>

Now save your file by Selecting Menu and then Save. Click on the “Save as Type” drop down box and select the option “All Files”. When asked to name your file, name it “index.html”, without the quotes. Double check that you did everything correctly and then press save. Now open your file in a new web browser so that you have the ability to refresh your page and see your changes. If you opened up your index.html document, you should be starring at your very first blank (white) web page!