Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What extension should I use for files containing fragments of HTML?

Tags:

html

The ".html" suffix on a filename implies that the document contains html, head, and body tags.

I have some files that each contains a div element or two, but no html or body tags. The file contents are well-formed HTML fragments in the sense that they could be inserted into a body tag of a compliant HTML document, and it would still be compliant. (They contain no "<% %>" markers, no PHP code, etc.) But a fragment file is not compliant HTML by itself, so I'd like to give it a different naming convention.

Several "file extension" sites include an entry for ".PHT" and describe it as "Partial Hypertext File." That sounds promising, but I can't find any additional explanation on the origin, expected file format, or applications that use it. Also, many of the same sites identify ".phtml" and ".phtm" (which appear to be longer versions of the .pht suffix) as PHP files — as noted, my files are not PHP files.

Should I use ".pht" as a suffix? Is there a more appropriate naming convention?

Edit: I'd like to distinguish fragment files from the full HTML documents in the same directory.

like image 768
system PAUSE Avatar asked May 01 '09 15:05

system PAUSE


People also ask

What file extensions do HTML files use?

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.

How do I use HTML fragments?

To create a new HTML Fragment:Click on the New HTML Fragment button at the top of the screen. In the Description box enter something descriptive so that you know what the HTML code is for or what it does. This is just for your reference and will not appear on your site. Paste your HTML code into the large HTML Code ...


1 Answers

I would use .inc (meaning include file) or .txt.

like image 58
Daniel A. White Avatar answered Sep 21 '22 08:09

Daniel A. White