I need some help with web programming. I have to do this assignment from school and the prof has given details on the structuring. One of them is that my site should be XHTM
Depending on your assignment's definition of "HTML5", this is impossible with markup alone. A document cannot use a new HTML5 element while remaining compliant with any of the XHTML 1.0 doctypes.
However if you're allowed to use JavaScript APIs that were introduced with HTML5, such as localStorage, you may be able to get away with writing a script to access those APIs while not using any new HTML5 elements like <header>
or <nav>
. Those APIs are not tied to HTML5 markup and so can be used with any flavor of markup, but are generally called "HTML5 features" anyway.
The interpretation of the assignment that seems to make most sense is that you are required to use XHTML linearization of HTML5, also known as XHTML5. This simply means that you use HTML5 like anyone else but do that using general XML principles.
In the example case, this would mean the following markup:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body id="index" class="home">
<header id="banner" class="body">
<h1><a href="#">Header1 </a></h1>
<nav><ul>
<li class="active"><a href="#">home</a></li>
<li><a href="#">portfolio</a></li>
<li><a href="#">blog</a></li>
<li><a href="#">contact</a></li>
</ul></nav>
</header>
</body>
</html>
The XHTML 1.0 doctypes are something quite different. They define fixed versions of HTML, so you cannot use, in the static markup, anything not allowed by those versions, i.e. anything that is new in HTML5 as compared with XHTML 1.0 and HTML 4.01 (which is what “HTML5 feature” probably means in the assignment). The requirement “XHTML compliant (Strict or Transitional)” is obscure, but if it is meant to refer to XHTML 1.0 specifically, then the assignment is self-contradictory (unless you are supposed to use client-side scripting to get to “HTML5 features”).
(This answer was largely rewritten thanks to @Alohci’s comments.)