Simple html file format
What is an HTML file?
HTML (Hyper Text Markup Language) is the extension for web pages created for display in browsers. Known as language of the web, HTML has evolved with requirements of new information requirements to be displayed as part of web pages. The latest variant is known as HTML 5 that gives a lot of flexibility for working with the language. HTML pages are either received from server, where these are hosted, or can be loaded from local system as well. Each HTML page is made up of HTML elements such as forms, text, images, animations, links, etc. These elements are represented by tags and several others where each tag has start and end. It can also embed applications written in scripting languages such as JavaScript and Style Sheets (CSS) for overall layout representation.
Brief History
Since its inception and first role out, the HTML specifications have been maintained by World Wide Web Consortium (W3C) since 1996. In 2000, it also became an international standard (ISO/IEC 15445:2000). In 1999, HTML 4.01 was published. In 2004, the Web Hypertext Application Technology Working Group (WHATWG) started working on the HTML5 version which became a joint deliverable with the W3C in 2008. It was completed and standardized on 28 Oct 2014.
HTML File Format Structure
An HTML 4 document is composed of three parts:
- a line containing HTML version information
- a declarative header section
- a body, which contains the document’s actual content. The body may be implemented by the BODY element or the FRAMESET element to contain the body in frames
Each section can be lead or followed by white spaces, newlines, tabs and comments. An example of a simple HTML document is as shown below:
Understanding HTML File Format Hello World!
Version Information
The first line of code, , is called a doctype declaration and tells the browser which version of HTML the page is written in. Depending upon the version of HTML, there are a number of different doctype declarations that names the document type definition (DTD) in use for the document. Each DTD differs from other in the elements it supports and differ as follow:
- HTML 4.01 Strict — includes all elements and attributes that have not been deprecated or do not appear in frameset documents
- HTML 4.01 Transitional — includes everything in the strict DTD plus deprecated elements and attributes (most of which concern visual presentation
- HTML 4.01 Frameset — includes everything in the transitional DTD plus frames as well
For HTML5, the version information is simply as mentioned below.
HTML Header Information
Header of an HTML document can include a number of HTML elements that are not rendered by the browser. Such elements are either metadata that describe information about the page or includes sections that are used to fetch information from external resources like CSS stylesheets or JavaScript files. Header of a page is represented by the head tag.
For setting page title, the title element is the only one that is required within the tags. The same is used by Search engines to identify the title of a page.
HTML Body Information
This is the main section in the file that contains all the contents of the file that are rendered by browsers. Html body can contain markups that can refer to various building blocks in the shape of tags. It can contain several different types of information like text, images, colors, graphics, etc. In addition, audio and video elements can also be embedded in html body for rendering by browsers. In presence of modern style sheets application for visual representation, the presentation attributes of BODY such as background color, link color, text color, etc. have been deprecated. Thus, the same effects can be achieved using stylesheets as shown below:
Inline Style Sheets referencing BODY < background: white; color: black>A:link < color: red >A:visited < color: maroon >A:active . document body.
Inline style sheets are easy to embed and for quick applications to the visual effects, external style sheets make it more convenient to deploy once and access at many places.
Linking to External style sheets . document body.
HTML Elements
As mentioned earlier, contents inside HTML Body are represented by tags, also known as Html Elements. Each tag can have additional information in the form of attributes which are written as , though it is not necessary to have attributes with every tag. If attributes are not mentioned, default values are used in each case. Following are some of the Element examples:
Header
Headings
Heading level 1
Heading level 2
Heading level 3
Heading level 4
Heading level 5
Heading level 6
Paragraphs
References
See Also
Simple html file format
What is an HTM file?
Files with .htm extension represent Hypertext Markup Language for creating web pages for display in web browsers such as Google Chrome, Internet Explorer, Firefox and a number of others. It defines the markups for creating static pages to be published on World Wide Web (WWW) for access by others. These markups tell the browsers how to display a web page’s contents. Such pages can contain plain text, images, hyperlinks to other pages, videos and other media information. When a web page is published, you can have a look at the markup code behind it by viewing its page source. Modern browsers allow to inspect each section of a web page where each sub-division or markup element in the HTM source is elaborated.
Brief History of HTM
Since its inception and first role out, the HTML specifications have been maintained by World Wide Web Consortium (W3C) since 1996. In 2000, it also became an international standard (ISO/IEC 15445:2000). In 1999, HTML 4.01 was published. In 2004, the Web Hypertext Application Technology Working Group (WHATWG) started working on the HTML5 version which became a joint deliverable with the W3C in 2008. It was completed and standardized on 28 Oct 2014.
HTML File Format
An HTML 4 document is composed of three parts:
- a line containing HTML version information
- a declarative header section
- a body, which contains the document’s actual content. The body may be implemented by the BODY element or the FRAMESET element to contain the body in frames
Each section can be lead or followed by white spaces, newlines, tabs and comments. An example of a simple HTML document is as shown below:
Understanding HTML File Format Hello World!
Version Information
The first line of code, , is called a doctype declaration and tells the browser which version of HTML the page is written in. Depending upon the version of HTML, there are a number of different doctype declarations that names the document type definition (DTD) in use for the document. Each DTD differs from other in the elements it supports and differ as follow:
- HTML 4.01 Strict — includes all elements and attributes that have not been deprecated or do not appear in frameset documents
- HTML 4.01 Transitional — includes everything in the strict DTD plus deprecated elements and attributes (most of which concern visual presentation
- HTML 4.01 Frameset — includes everything in the transitional DTD plus frames as well
For HTML5, the version information is simply as mentioned below.
Header Information
Header of an HTML document can include a number of HTML elements that are not rendered by the browser. Such elements are either metadata that describe information about the page or includes sections that are used to fetch information from external resources like CSS stylesheets or JavaScript files. Header of a page is represented by
tag and ends with tag.For setting page title, the element is the only one that is required within the tags. The same is used by Search engines to identify the title of a page.
Body Information
This is the main section in the file that contains all the contents of the file that are rendered by browsers. Html body can contain markups that can refer to various building blocks in the shape of tags. It can contain several different types of information like text, images, colors, graphics, etc. In addition, audio and video elements can also be embedded in html body for rendering by browsers. In presence of modern style sheets application for visual representation, the presentation attributes of BODY such as background color, link color, text color, etc. have been deprecated. Thus, the same effects can be achieved using stylesheets as shown below:
Inline Style Sheets referencing BODY < background: white; color: black>A:link < color: red >A:visited < color: maroon >A:active . document body.
Inline style sheets are easy to embed and for quick applications to the visual effects, external style sheets make it more convenient to deploy once and access at many places.
Linking to External style sheets . document body.
HTML Elements
As mentioned earlier, contents inside HTML Body are represented by tags, also known as Html Elements. Each tag can have additional information in the form of attributes which are written as
though it is not necessary to have attributes with every tag. If attributes are not mentioned, default values are used in each case. Following are some of the Element examples:
Header
Headings
Heading level 1
Heading level 2
Heading level 3
Heading level 4
Heading level 5
Heading level 6
Paragraphs
References
See Also
HTML Get Started
An HTML file is simply a text file saved with an .html or .htm extension.
Getting Started
In this tutorial you will learn how easy it is to create an HTML document or a web page. To begin coding HTML you need only two things: a simple-text editor and a web browser.
Well, let’s get started with creating your first HTML page.
Creating Your First HTML Document
Let’s walk through the following steps. At the end of this tutorial, you will have made an HTML file that displays «Hello world» message in your web browser.
Step 1: Creating the HTML file
Open up your computer’s plain text editor and create a new file.
Tip: We suggest you to use Notepad (on Windows), TextEdit (on Mac) or some other simple text editor to do this; don’t use Word or WordPad! Once you understand the basic principles, you may switch to more advanced tools such as Adobe Dreamweaver.
Step 2: Type some HTML code
Start with an empty window and type the following code:
Example
Hello World!
Step 3: Saving the file
Now save the file on your desktop as «myfirstpage.html «.
Note: It is important that the extension .html is specified — some text editors, such as Notepad, will automatically save it as .txt otherwise.
To open the file in a browser. Navigate to your file then double click on it. It will open in your default Web browser. If it does not, open your browser and drag the file to it.
Explanation of code
You might wonder what that code was all about. Well, let’s find out.
- The first line is the document type declaration. It instructs the web browser that this document is an HTML5 document. It is case-insensitive.
- The element is a container for the tags that provides information about the document, for example, tag defines the title of the document.
- The element contains the document’s actual content (paragraphs, links, images, tables, and so on) that is rendered in the web browser and displayed to the user.
You will learn about the different HTML elements in detail in the upcoming chapters. For now, just focus on the basic structure of the HTML document.
Note: A DOCTYPE declaration appears at the top of a web page before all other elements; however the doctype declaration itself is not an HTML tag. Every HTML document requires a document type declaration to insure that your pages are displayed correctly.
Tip: The ,
, and tags make up the basic skeleton of every web page. Content inside the and are invisible to users with one exception: the text between tags which appears as the title on a browser tab.HTML Tags and Elements
HTML is written in the form of HTML elements consisting of markup tags. These markup tags are the fundamental characteristic of HTML. Every markup tag is composed of a keyword, surrounded by angle brackets, such as , , , ,
, and so on.
HTML tags normally come in pairs like and . The first tag in a pair is often called the opening tag (or start tag), and the second tag is called the closing tag (or end tag).
An opening tag and a closing tag are identical, except for a slash ( / ) after the opening angle bracket of the closing tag, to tell the browser that the command has been completed.
In between the start and end tags you can place appropriate contents. For example, a paragraph, which is represented by the p element, would be written as:
Example
This is a paragraph.
This is another paragraph.
You will learn about the various HTML elements in upcoming chapter.