Home  >  Article  >  Web Front-end  >  What is the extension of html files? What is the file type of the file?

What is the extension of html files? What is the file type of the file?

青灯夜游
青灯夜游Original
2022-09-16 16:40:1317714browse

There are two extensions for html files: "html" and "htm". An html file is a plain text file, a descriptive text composed of HTML commands, and a static web page file; an HTML file can only write plain text when editing, and cannot directly write text like a ".doc" document. Content styling.

What is the extension of html files? What is the file type of the file?

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

The full English name of HTML is Hyper Text Markup Language, which is translated into Chinese as "Hyper Text Markup Language" and is specially used to design and edit web pages.

Files written in HTML are called "HTML documents", and the general suffix is ​​.html (.htm can also be used, but it is rare). An HTML document is a plain text file that you can open or create using text editors such as Windows Notepad, Linux Vim, Notepad, Sublime Text, and VS Code.

HTML document = web page

  • HTML document describes the web page.

  • HTML documents are also called web pages.

  • HTML documents contain HTML tags and plain text.

HTML tags:

HTML is a markup language that uses various tags to format content. The characteristics of the tags are as follows:

  • HTML tags are composed of keywords surrounded by angle brackets, such as ;

  • ##With the exception of a few tags, most HTML tags appear in pairs , such as and ;

  • In tags that appear in pairs, the first tag is called the start tag, and the second tag is called the end tag ( closing tag).

Different tags in HTML have different meanings. Learning HTML is actually learning the meaning of each tag, and selecting appropriate tags according to the needs of the actual scenario to create beautiful web pages.


The role of the browser relative to HTML documents:
  • The role of the Web browserisRead HTML document , and display the content in the form of a web page.
  • Web browsers do not display the HTML tag , which uses tags to explain the content of the page .

  • HTML tag code is as follows:
nbsp;html>


    <meta>
    <title>第一个网页</title>


    <h1>这是我的第一个网页</h1>
    <p>我一定会成为一名优秀的前端开发工程师。</p>

Explanation of tag code in this example:

1. The description of the web page must be written in the

tag. 2. Title, character encoding, compatibility, keywords, description and other information must be written in the

tag. 3. The content to be displayed on the web page must be written in the

tag. Although sometimes code written not according to standards can be displayed normally, as a professional quality, formal writing habits must be developed.

  • Document declaration header. Inform the browser which html version is used for writing (here is HTML5).
  • Indicates to search engines that the page is in html language and the language is English.
  • Title tag. Adds the semantics of a title to the text content.
  • Paragraph tag. Adds the semantics of a paragraph to the text content. .
When the editor runs this code, the web browser will compile the HTML tag code and use the tags to explain the content of the page.

The final running result is to display the content of the page without displaying HTML tags.
The Web browser display effect is as follows:


What is the extension of html files? What is the file type of the file?

OK Let’s get to know what a “plain text” file is:
Windows comes with a software called Notepad.
  • The document format saved by Notepad is .txt format
    , which is the abbreviation of English text. In terminology, this file is called: "Plain text file
    ".
The meaning and difference between non-plain text files and plain text files:

** .doc non-plain text files:* *
  • We did a small experiment
    , opened our word software, wrote a document and then saved it, and found that the saved document suffix format is .doc. In addition, during the writing process, we also discovered that the file .doc in this format can also set and save the text style. For example, the text can be blue or orange, and the text can also be underlined. And many more styles.
  • ** .txt plain text file:**
    Now weopen the Notepad that comes with Windows and write, we find that during the writing process The text cannot be colored or underlined. .

What is the extension of html files? What is the file type of the file?

##Summary of the meaning and difference between non-plain text files and plain text files:

Meaning:

  • Non-plain text file (such as .doc):In addition to text, it can also set a variety of styles for the text .
  • Plain text file (such as .txt):It only has text and no style.

Difference:

  • Non-plain text files (such as .doc):It except It has the basic functions of writing text like plain text, and can also set and save text styles, such as saving text settings as different text colors, setting underlines for text, and many other styles.
  • Plain text file (such as .txt):In one sentence, it can only write text in a regular and honest manner, and cannot set text Any style.
Note: When .doc and .txt store the same content, .doc is larger than .txt (because it contains styles).
Why do we first explain the meaning and difference between non-plain text files and plain text files?
  • Because:
    HTML is plain text!
    HTML files can only write plain text when editing. You will find that it cannot directly style text content like .doc documents. !

We can do a small experiment, which is also the most classic experiment that proves that HTML is a plain text file:

We are on the computer Create a new Notepad .txt file on the desktop. Open it and write any text content, then Ctrl S to save, and then close the file.

What is the extension of html files? What is the file type of the file?

Next step we forcefully change the .txt extension of the file to the .html extension. At this time, the .html file is a web page file

What is the extension of html files? What is the file type of the file?

What is the extension of html files? What is the file type of the file?

What is the extension of html files? What is the file type of the file?

At this time we use the browser to open it, and we find that the browser can display the original version normally All the content!

What is the extension of html files? What is the file type of the file?

In this way, I started to modify a .txt file into a .html file, until I finally ran it using the browser, I found that the entire content would be displayed normally, which is enough. Prove that HTML is a plain text file!

In addition, we can also use Notepad to write HTML files, because HTML files are completely plain text files (but no one does this in actual development, here is just an explanation) .

For more programming related knowledge, please visit:

Programming Video! !

The above is the detailed content of What is the extension of html files? What is the file type of the file?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn