Home  >  Article  >  Web Front-end  >  Is the html file a plain text file?

Is the html file a plain text file?

青灯夜游
青灯夜游Original
2021-03-04 13:53:479743browse

html files are plain text files. HTML text is descriptive text composed of HTML commands and is a static web page file. HTML files can only write plain text when editing, and cannot directly style the text content like ".doc" documents.

Is the html file a plain text file?

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

First: What is HTML

HTML is a language used to describe web pages.

  • HTML is: Hyper Text Markup Language.
    "Hypertext" means that the page can contain pictures, links, and even non-text elements such as music and programs.
    "Markup Language" means a set of markup tags (Markup Tag).
  • HTML is not a programming language, but amarkup language (Markup Language).
  • HTML uses the tag tag to describe and define the content structure of the web page.

HTML tag:

  • HTML markup tag is usually Called HTML tag (HTML Tag).
  • HTML tags are keywords surrounded by angle brackets, such as .
  • HTML tags usually appear in pairs, such as

    and

    .
    The first tag of in tag pair is the starting tag , and the second tag of is the ending tag .
    This type of begins and ends with a tag that is presented, we generally call it "double tag".
  • Of course there are also tags presented separately, such as Is the html file a plain text file? etc.
    This type of tag presented alone is generally called "single tag" or "self-closing tag".
  • Generally Tags that appear in pairs (double tags), The content is in the middle of the two tags, such as:
    <h1> I am the content and I write in the middle of the double label. </h1> :
    ##【 Recommended tutorial: "html video tutorial
    "】

HTML document = web page


HTML Document description page.

HTML documents are also called web pages.

HTML documents contain HTML tags and plain text.
  1. The role of the browser relative to HTML documents:
  2. The role of the Web browser
is
reading HTML documents
, 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 needs to be written in
    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).

    <p></p> Indicates to search engines that the page is in html language and the language is English.
    • <h1></h1> Title tag. Adds the semantics of a title to the text content.
    • <p></p> 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.
    • Web browser display effect is as follows:


    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.

    Is the html file a plain text file?

    ##** .txt plain text file:**
      Now let’s
    • open the Notepad that comes with Windows And while writing
      , we found that during the writing process, cannot set color, underline and other styles for the text. .

    Is the html file a plain text 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 create a new Notepad.txt file on the computer desktop. Open it and write whatever you want. After the text content, press Ctrl S to save, and then close the file. Next step we forcibly change the .txt extension of the file to the .html extension. At this time, the .html file is a web page file. At this time, we use the browser to open it, and we find that the browser is completely The entire original content can be displayed normally!In this way, a .txt file is modified into a .html file, and until finally run using a browser, it is found that the entire content is displayed normally, which is enough to 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
    ! ! <p></p>

    The above is the detailed content of Is the html file a plain text 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