Html: Difference between revisions

From miki
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:
* http://www.freeformatter.com/html-entities.html
* http://www.freeformatter.com/html-entities.html
* https://dev.w3.org/html5/html-author/charref
* https://dev.w3.org/html5/html-author/charref

== Examples ==

=== Basic ===
<source lang="html">
<!DOCTYPE html>
<html lang="en">
<head></head>
<body><p>A paragraph with <code style="font-family: Consolas;">styled code text</code>.</p></body>
</html>
</source>


== Include another file ==
== Include another file ==

Revision as of 08:34, 9 October 2019

References

Tools
Entities

Examples

Basic

<!DOCTYPE html>
<html lang="en">
<head></head>
<body><p>A paragraph with <code style="font-family: Consolas;">styled code text</code>.</p></body>
</html>

Include another file

Using server-side include
If it doesn't work, TRY NAMING THE FILE WITH A .shtml EXTENSION!
In Apache, SSI (include module) must be enabled.
<!--#include file="insertthisfile.html" -->
<!--#include virtual="insertthisurl_cgi.html" -->
Using server-side include - PHP
We can also use PHP, if the server is configured for it:
<?php include("filename.html"); ?>
<?php include("http://www.othersite.com/filename.html"); ?>

Tips and Pits

Set charset specification in the first 1024 bytes!
  • <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> in HEAD tag must come soon enough.
The page was reloaded, because the character encoding declaration of the HTML document was not found when prescanning the first 1024 bytes of the file. The encoding declaration needs to be moved to be within the first 1024 bytes of the file.