When I save a file with an .htm or .html extension, which one is correct and what is different?
The long answerBoth . htm and . html are exactly the same and will work in the same way. The choice is down to personal preference, provided you're consistent with your file naming you won't have a problem with either.
HTM and HTML are both file extensions of HTML files. The only difference is that . HTM is used as an alternate to . HTML for some operating systems and servers that do not accept four-letter extensions.
An HTM or HTML file is a Hypertext Markup Language file and is the standard web page file type on the internet. Since HTM files are text-only files, they just contain text (like what you're reading now), as well as text references to other external files (like the image in this article).
An HTML file is nothing more than plain ASCII text, but all HTML files must have a special file extension for web browsers to recognize them. This extension is either . htm OR . html.
Neither is wrong, it's a matter of preference. Traditionally, MS software uses htm
by default, and *nix prefers html
.
As oded pointed out below, the .htm tradition was carried over from win 3.xx, where file extensions were limited to three characters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With