Why is there such a gap between the codes that the browser sees after pressing F12?

Source: Internet
Author: User
Why is there such a gap between the source code and the code displayed by the browser following F12:
 Untitled Document 


Very clean code

Written directly in PHP Chrome F12 at Elements



This is a case. after some code is passed, the above HTML code is directly output.


This is the result of directly writing HTML code to the PHP file. Why is there such a big difference.


Reply to discussion (solution)

You can use the ob function to intercept php output and save it to a file.
Then compare the differences between files
If there is no difference, it is a browser problem, and you can't do anything.
If there is any difference, analyze the reasons for the difference

The code in the middle figure. Strictly speaking, this is also not a standard. However, the browser may have the error correction function, so the effect may be the same.

The code in the middle figure. Strictly speaking, this is also not a standard. However, the browser may have the error correction function, so the effect may be the same.



The first source code is a file created directly with DW! No modifications were made.
I tried Chrome and FF. The source code is the same.
Use F12 development tools in Elements
There are two quotation marks under the Body of the first image.

The second image is the same as the source code.

Very depressing!

Whether your html page contains a UTF8 file with a DOM header in the body. use the editor to convert the page to a file without DOM.

It is the dom header file generated by file editing in Notepad and intermediate transcoding.
We recommend that you directly create a blank file in ue, ediplus, and phpstorm, and copy the existing file content to it.

It is the dom header file generated by file editing in Notepad and intermediate transcoding.
We recommend that you directly create a blank file in ue, ediplus, and phpstorm, and copy the existing file content to it.



Correct BOM instead of DOM.

Whether your html page contains a UTF8 file with a DOM header in the body. use the editor to convert the page to a file without DOM.


BOM rather than DOM

In short, the two of you helped me find the problem !! I have been editing PHP with Editplus all the time. Recently, I have seen that Notepad ++ is quite fresh to use. this is a problem !! That's an emergency !!! I have been tossing for several days and cannot find the cause !!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.