Languages
[Edit]
EN

XHTML - basic XHTML 5 template

0 points
Created by:
maciek211
365

For each project, the basic XHTML5 template looks always in the following way.

1. Only body element example

// ONLINE-RUNNER:browser;

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
  Web page content here...
</body>
</html>

2. body + script element example

// ONLINE-RUNNER:browser;

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
  <script>
    // script here
  </script>
</body>
</html>

3. head + body elements 

Example 1

// ONLINE-RUNNER:browser;

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <!-- head tags here... -->
</head>
<body>
  Web page content here...
</body>
</html>

Example 2

// ONLINE-RUNNER:browser;

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <style>
    /* style here */
  </style>
  <script>
    // script here
  </script>
</head>
<body>
  Web page content here...
</body>
</html>

Example 3

// ONLINE-RUNNER:browser;

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8" />
  <title>Example template</title>
  <link rel="stylesheet" href="path/to/my/styles.css" />
  <script type="text/javascript" src="path/to/my/script.js"></script>
</head>
<body>
  <p>Web page text...</p>
</body>
</html>

Example 4

// ONLINE-RUNNER:browser;

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <meta charset="utf-8" />
  <title>Example template</title>
  <meta name="description" content="Example template description." />
  <meta name="author" content="dirask.com" />
  <link rel="stylesheet" href="path/to/my/styles.css" />
  <style>

    /* Place for styles */

  </style>
  <script type="text/javascript" src="path/to/my/script.js"></script>
</head>
<body>
  <p>Web page text...</p>
  <script>

    alert('Hello world!');  

  </script>
</body>
</html>

See also

  1. HTML - basic HTML 5 template

Alternative titles

  1. XHTML - basic XHTML5 template example
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join