<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Clearideaz &#187; balises</title>
	<atom:link href="http://clearideaz.com/tag/balises/feed/" rel="self" type="application/rss+xml" />
	<link>http://clearideaz.com</link>
	<description>webdesigner et intégrateur XHTML / CSS</description>
	<lastBuildDate>Mon, 20 Jun 2011 14:00:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Construire un document XHTML</title>
		<link>http://clearideaz.com/2008/02/construire-un-document-xhtml/</link>
		<comments>http://clearideaz.com/2008/02/construire-un-document-xhtml/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 09:06:00 +0000</pubDate>
		<dc:creator>Olivier G.</dc:creator>
				<category><![CDATA[HTML / CSS]]></category>
		<category><![CDATA[balises]]></category>
		<category><![CDATA[tutos]]></category>
		<category><![CDATA[w3c]]></category>
		<category><![CDATA[xhtml]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.clearideaz.com/?p=25</guid>
		<description><![CDATA[<p> <img alt="le Xhtml, c'est chaud :)" src="public/xhtml.gif" />Le <strong>XHTML</strong> (<em>eXtended HyperText Markup Language</em>) est, à l'instar du HTML, un langage de balisage. Sa syntaxe est basée sur la syntaxe du <abbr title="Extensible Markup Language">XML</abbr>. Il existe différentes versions du <abbr title="eXtended HyperText Markup Language">XHTML</abbr> : </p> <ul> <li> <strong>XHTML 1.0 Strict</strong> : Il ne gère que le contenu du document et non l'affichage. C'est le type de document à privilégier. </li> <li> <strong>XHTML 1.0 Transitional</strong> : C'est la passerelle entre le <abbr title="HyperText Markup Language">HTML</abbr> et le XHTML. Il permet l'utilisation de balises liées </li></ul>]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-thumbnail wp-image-115" title="xhtml, c'est chaud !!!" src="http://clearideaz.com/wp-content/uploads/2008/02/xhtml.gif" alt="xhtml, c'est chaud !!!" />Le <strong>XHTML</strong> (<em>eXtended HyperText Markup Language</em>) est, à l&#8217;instar du HTML, un langage de balisage. Sa syntaxe est basée sur la syntaxe du <abbr title="Extensible Markup Language">XML</abbr>.</p>
<p>Il existe différentes versions du <abbr title="eXtended HyperText Markup Language">XHTML</abbr> :</p>
<ul>
<li> <strong>XHTML 1.0 Strict</strong> : Il ne gère que le contenu du document et non l&#8217;affichage. C&#8217;est le type de document à privilégier.</li>
<li> <strong>XHTML 1.0 Transitional</strong> : C&#8217;est la passerelle entre le <abbr title="HyperText Markup Language">HTML</abbr> et le XHTML. Il permet l&#8217;utilisation de balises liées à l&#8217;affichage.</li>
<li> <strong>XHTML 1.0 Frameset</strong> : C&#8217;est le seul type de document qui autorise les frames. Logiquement, un document accessible ne doit pas inclure d&#8217;éléments frame donc à éviter&#8230;</li>
<li> <strong>XHTML 1.1</strong> : C&#8217;est une évolution du XHTML 1.0 Strict avec quelques balises qui ont été implantés ou modifiés.</li>
</ul>
<p>Lors de la construction d&#8217;un document XHTML, il est important d&#8217;avoir à l&#8217;esprit que ce n&#8217;est pas l&#8217;apparence du site qui engendre le balisage mais bien le contenu de ce document.</p>
<p>Pour l&#8217;élaboration d&#8217;un document type, nous prendrons le XHTML Strict 1.0 comme référence. Nous ne gérerons que le contenu. Exit les propriétés d&#8217;affichage tels que <em>bgcolor</em>, <em>color</em> ou encore <em>size</em>. Nous éviterons, de ce fait, de placer l&#8217;attribut (tout à fait valide) <em>style=&nbsp;&raquo;"</em> qui insère dans le document des propriétés <abbr title="Cascading Style Sheet">CSS</abbr>. Cela se fera dans une feuille de style externe. Le XHTML nécessite de se mettre en conformité avec certaines règles :</p>

<ul>
<li> <strong>Le XHTML impose l&#8217;utilisation d&#8217;attributs</strong><br />
<em>&lt;input type=&nbsp;&raquo;checkbox&nbsp;&raquo; name=&nbsp;&raquo;_option-test&nbsp;&raquo; id=&nbsp;&raquo;option-test&nbsp;&raquo; value=&nbsp;&raquo;" checked&gt;</em> en HTML s&#8217;écrit en XHTML : <em>&lt;input type=&nbsp;&raquo;checkbox&nbsp;&raquo; name=&nbsp;&raquo;_option-test&nbsp;&raquo; id=&nbsp;&raquo;option-test&nbsp;&raquo; value=&nbsp;&raquo;" checked=&nbsp;&raquo;checked&nbsp;&raquo; /&gt;</em></li>
<li> <strong>Toute balise ouverte doit être refermée</strong><br />
Vous pourrez remarquer dans l&#8217;exemple ci-dessus le slash à la fin de la balise input.</li>
<li> <strong>Les balises doivent être correctement imbriquées</strong><br />
Un ordre hiérarchique des balises est défini. C&#8217;est l&#8217;ordre logique de lecture du document qui déterminera l&#8217;agencement des balises et non l&#8217;affichage que le site devra avoir à l&#8217;écran.</li>
<li> <strong>Toute la syntaxe doit être rédigée en bas de casse</strong><br />
Autrement dit, en minuscule.</li>
<li> <strong>Les attributs obligatoires ne doivent pas être omis</strong><br />
On citera notamment <em>alt</em> pour la balise <em>img</em>.</li>
<li> <strong>Chaque attribut sera encadré de guillemets<br />
</strong> L&#8217;utilisation de double-quote est <del>donc de rigueur</del> conseillé pour chaque attribut de balise.</li>
</ul>
<h3>L&#8217;entête du document</h3>
<p>L&#8217;entête de page permet au navigateur de connaître un certain nombre d&#8217;informations avant de charger le corps de page (le contenu). On y trouvera par exemple, le type d&#8217;encodage (UTF-8 ou ISO), le titre du document ou l&#8217;appel à des fichiers externes (feuilles de style, javascript). L&#8217;entête est introduit par la balise <em>&lt;head&gt;</em> qui est insérée juste après le balise <em>&lt;html&gt;</em>.</p>
<p>La première étape n&#8217;est pas indispensable. On indique au navigateur qu&#8217;il s&#8217;agit d&#8217;un document XML tout en renseignant dans l&#8217;attribut encoding, l&#8217;encodage des caractères (ici ISO) :</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt; ?xml <span style="color: #000066;">version</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1.0&quot;</span> encoding<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;iso-8859-1&quot;</span>?&gt;</span></pre></div></div>

<p>Un problème se pose toutefois avec Internet Explorer. En effet, en affichant cette balise avant le doctype, le navigateur passe en quirks mode, c&#8217;est-à-dire en mode non-standard.</p>
<p>Le DOCTYPE est la seconde chose à spécifier dans le document XHTML. Il permet au navigateur de savoir à quel type de document il a à faire. Voici les DOCTYPEs XHTML qu&#8217;il est possible d&#8217;insérer :</p>
<h4>XHTML 1.0 Strict</h4>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt; !DOCTYPE html PUBLIC <span style="color: #ff0000;">&quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;</span> </span>
<span style="color: #009900;"><span style="color: #ff0000;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;</span>&gt;</span></pre></div></div>

<h4>XHTML 1.0 Transitional</h4>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt; !DOCTYPE html PUBLIC <span style="color: #ff0000;">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> </span>
<span style="color: #009900;"><span style="color: #ff0000;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span>&gt;</span></pre></div></div>

<h4>XHTML 1.0 Frameset</h4>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt; !DOCTYPE html PUBLIC <span style="color: #ff0000;">&quot;-//W3C//DTD XHTML 1.0 Frameset//EN&quot;</span> </span>
<span style="color: #009900;"><span style="color: #ff0000;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd&quot;</span>&gt;</span></pre></div></div>

<h4>XHTML 1.0 Strict</h4>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt; !DOCTYPE html PUBLIC <span style="color: #ff0000;">&quot;-//W3C//DTD XHTML 1.1//EN&quot;</span> </span>
<span style="color: #009900;"><span style="color: #ff0000;">&quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;</span>&gt;</span></pre></div></div>

<p>Ensuite, il faut renseigner la balise <em>&lt;html&gt;</em> avec un namespace utilisant l&#8217;attribut xmlns. On prendra le soin de spécifier la langue du document dans les balises <em>xml:lang=&nbsp;&raquo;la_langue&nbsp;&raquo;</em> et <em>lang=&nbsp;&raquo;la_langue&nbsp;&raquo;</em>. Cette redondance est requise pour la validité du document et la compatibilité avec les différents navigateurs. Ces deux attributs ont la même fonction mais lang=&nbsp;&raquo;" permet en réalité d&#8217;être compris sur les anciens navigateur.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> xml:<span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fr&quot;</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fr&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>Nous passons ensuite à l&#8217;entête du document par le biais de la balise <em>&lt;head&gt;</em>. Cette balise permettra de lier au document une ou plusieurs feuilles de styles, d&#8217;insérer des appels à des fichiers javascript. Mais auparavant, il faut définir l&#8217;encodage du document à l&#8217;aide d&#8217;une balise meta :</p>
<p><strong>Pour de l&#8217;UTF-8</strong> (Encodage international) :</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html; charset=UTF-8&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p><strong>Pour de l&#8217;ISO</strong> (Encodage européen) :</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/HTML; charset=iso-8859-1&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>Pour plus d&#8217;info sur la notion d&#8217;encodage, lisez <a title="Se rendre sur l'article d'OpenWeb sur les jeux de caractères" href="http://openweb.eu.org/articles/jeux_caracteres/">l&#8217;article d&#8217;OpenWeb sur les jeux de caractères</a></p>
<p>On aura la possibilité d&#8217;ajouter différentes balises méta afin de permettre un meilleur référencement du document. En voici un exemple :</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;DC.title&quot;</span> xml:<span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fr&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Clearideaz.com, XHTML, CSS, Accessibilité, Marketing, Design web&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Gorzalka, Olivier&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;description&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Carnet web de Olivier Gorzalka&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>Comme vous pourrez le constatez, on utilise une balise meta avec dans l&#8217;attribut name DC. Il s&#8217;agit en fait d&#8217;un schéma de métadonnées générique préconisé par le W3C.</p>
<p>Nous pouvons maintenant définir le titre du document avec la balise <em>&lt;title&gt;</em>. Il faut qu&#8217;il soit explicite. Évitez de donner le même titre à toutes les pages de votre site. Pensez aux personnes non-voyantes (et pas seulement&#8230;) utilisant des lecteurs de d&#8217;écran et qui se repèrent grâce aux dénominations des différents articles. Le titre se présentera de la façon suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
     Clearideaz.com, XHTML, CSS, Accessibilité, Marketing, Design web
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span></pre></div></div>

<p>A la suite de ce <em>&lt;title&gt;</em>, on insère l&#8217;appel éventuel à une feuille de style. Il existe deux méthodes sensiblement équivalentes :</p>
<p><strong>La méthode @import :</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--</span>
<span style="color: #808080; font-style: italic;">     @import url(/themes/clearideaz/style.css);</span>
<span style="color: #808080; font-style: italic;">--&gt;</span></pre></div></div>

<p><strong>La méthode link</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;themes/clearideaz/style.css&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;screen&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>Il n&#8217;existe pas, en soit, de grandes différences entre ces deux méthodes. Nous signalerons tout de même que <em>@import</em> n&#8217;est pas reconnue par les navigateurs dinosaures tels que Netscape 4.</p>
<h3>Le corps du document</h3>
<p>Nous arrivons au corps du document via la balise <em>&lt;body&gt;</em>. C&#8217;est le contenu qui sera visible dans le navigateur internet. On s&#8217;efforcera de hiérarchiser au maximum les éléments textuels. Il est important de ne pas penser à l&#8217;apparence du site lorsque l&#8217;on procède au balisage du document. Il faut respecter l&#8217;ordre de lecture du contenu. Nous userons par exemple des différents niveaux de titre : <em>&lt;h1&gt;, &lt;h2&gt;, &lt;h3&gt;</em>, &#8230; Lorsqu&#8217;il s&#8217;agira d&#8217;une liste d&#8217;éléments, on utilisera les listes à puce :</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Sciences de la vie<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Bienvenue sur le site &quot;Sciences de la vie&quot;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Le monde animal<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Voici différents animaux :<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Le chien<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Le singe<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Le tigre<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></div></div>

<p><em>Rappel : Chaque balise ouverte doit être obligatoirement refermée. Ainsi un paragraphe de texte commencera par &lt;p&gt; et se terminera par &lt;/p&gt;. Les balises de retour à la ligne ne s&#8217;écrivent plus &lt;br&gt; comme ce fut le cas dans le HTML mais &lt;br /&gt;. Idem pour &lt;hr&gt; qui devient &lt;hr /&gt;.</em></p>
<p>Un document XHTML type n&#8217;organisera pas son contenu à l&#8217;aide de tableau. Pour une meilleure hiérarchisation, on utilisera les calques qui se traduisent par des balises <em>&lt;div&gt;</em>. Ces balises nous permettrons par la suite de styler le document à l&#8217;aide de la feuille CSS. Il est judicieux d&#8217;attribuer à chaque balise <em>&lt;div&gt;</em> un ID explicite qui permettra de les différencier lors de l&#8217;élaboration de la feuille de style :</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page&quot;</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;entete&quot;</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;conteneur&quot;</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-principal&quot;</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Rubrique 1<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Rubrique 2<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Rubrique 3<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;contenu&quot;</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pied&quot;</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Créé par Moi :)<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Évitez de multipliez les calques, cela facilitera la compréhension de votre balisage.</p>
<p>Enfin on ferme la balise <em>&lt;body&gt;</em> et <em>&lt;html&gt;</em> du document. Voici donc ce que l&#8217;on pourrait obtenir :</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt; !DOCTYPE html PUBLIC <span style="color: #ff0000;">&quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;</span> <span style="color: #ff0000;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> xml:<span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fr&quot;</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fr&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html; charset=UTF-8&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;DC.title&quot;</span> xml:<span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fr&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Weblog.fr, XHTML, CSS, Accessibilité, Marketing, Design web&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Gorzalka, Olivier&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;description&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Carnet web de Olivier Gorzalka&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Weblog.fr, XHTML, CSS, Accessibilité, Marketing, Design web<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">style</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;screen&quot;</span>&gt;</span>
          @import url(/themes/weblogr/style.css);
     <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">style</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page&quot;</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;entete&quot;</span>&gt;</span>
               <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Sciences de la vie<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;conteneur&quot;</span>&gt;</span>
               <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-principal&quot;</span>&gt;</span>
                    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Rubrique 1<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
                    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Rubrique 2<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
                    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Rubrique 3<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
               <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
               <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;contenu&quot;</span>&gt;</span>
                    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Bienvenue sur le site &quot;Sciences de la vie&quot;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
                    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Le monde animal<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
                    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Voici différents animaux :<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
                    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
                         <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Le chien<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
                         <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Le singe<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
                         <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Le tigre<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
                    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
               <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pied&quot;</span>&gt;</span>
               <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Créé par Moi :)<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<h3>La validation W3C</h3>
<p>Une fois le document XHTML terminé, il faut passer le fichier HTML au <a title="Voir le validateur W3C" href="http://validator.w3.org/">validateur W3C</a>. Le W3C est un consortium visant à promouvoir la compatibilité des technologies du Web et notamment le XHTML. En vérifiant la validité de la syntaxe de votre site, vous aurez la certitude que les différents documents XHTML respectent les standards du web. Si votre document contient des erreurs, le validateur vous les listera et il faudra bien évidemment les corriger <img src='http://clearideaz.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h3>Les balises courantes</h3>
<p>Il existe un grand nombre de balises XHTML qui permettent de rendre le document plus compréhensible. Je vous invite à visiter <a title="Voir l'espace de Giminik" href="http://giminik.developpez.com/xhtml/">l&#8217;espace de Giminik</a> qui recense l&#8217;ensemble des balises courantes du XHTML. Il existe deux grandes catégories de balises. Les inline (en-ligne) et les block (bloc). Les balises blocs permettent de structurer le document et peuvent contenir d&#8217;autres balises block ou inline. Les inline quant à eux attribue une sémantique spécifique à des mots d&#8217;une phrase et ne peut contenir que des éléments inline.</p>
<h4>Les balises de type block</h4>
<p><strong>&lt;div&gt;<br />
</strong> Elle donne la possibilité de structurer le contenu en différent blocs couramment appelés calques.</p>
<p><strong>&lt;h1&gt;, &lt;h2&gt;, &lt;h3&gt;, &lt;h4&gt;, &lt;h5&gt;, &lt;h6&gt;</strong><br />
Ils définissent différents niveaux de titre <em>(ex: &lt;h2&gt;Mon titre&lt;/h2&gt;).</em> Il est à noter que la balise <em>&lt;h1&gt;</em> ne peut être utilisée qu&#8217;une fois.</p>
<p><strong>&lt;hr /&gt;<br />
</strong> Cette balise insère une ligne horizontale dans le document.</p>
<p><strong>&lt;p&gt;</strong><br />
Cette balise identifie un élément comme paragraphe.</p>
<p><strong>&lt;ul&gt;, &lt;ol&gt;, &lt;li&gt;</strong><br />
Elles intègrent des listes d&#8217;éléments au document. La balise <em>&lt;ul&gt;</em> insère une liste à puces tandis que <em>&lt;ol&gt;</em> dresse une liste ordonnée. Les différents éléments de la liste sont encadrés par la balise <em>&lt;li&gt;</em>.</p>
<h4>Les balises de type inline</h4>
<p><strong>&lt;a&gt;<br />
</strong> Elle insère un lien hypertexte sur le texte balisé. Elle peut aussi agir comme point d&#8217;ancrage dans le document.</p>
<p><strong>&lt;br /&gt;<br />
</strong> Elle permet d&#8217;insérer un saut de ligne. A utiliser avec parcimonie&#8230;</p>
<p><strong>&lt;em&gt;</strong><br />
Le texte est mis en emphase? On l&#8217;assimile souvent à tort avec la balise <em>&lt;i&gt;</em>.</p>
<p><strong>&lt;strong&gt;<br />
</strong> Elle permet de réalise une mise en emphase forte.</p>
<p><strong>&lt;span&gt;<br />
</strong> Elle donne la possibilité de mettre en forme du texte à l&#8217;aide de CSS.</p>
<p><strong>&lt;img /&gt;</strong><br />
Cette balise insère une image dans le document. Elle doit automatiquement intégrer un attribut <em>alt=&nbsp;&raquo;"</em>.</p>
<p><strong>&lt;cite&gt;</strong><br />
Elle défini un texte comme citation. L&#8217;équivalent en block est <em>blockquote</em>.</p>
<p><strong>&lt;abbr&gt;</strong><br />
Elle donne la signification d&#8217;une abréviation. (<em>ex: &lt;abbr title=&nbsp;&raquo;Cascading Style Sheet&nbsp;&raquo;&gt;CSS&lt;/abbr&gt;).</em></p>
<p><strong>&lt;q&gt;</strong><br />
Elle caractérise une courte citation.</p>
<h3>Ce qu&#8217;il faut éviter</h3>
<p>Voici quelques petites choses à éviter lors de la création de votre document XHTML.</p>
<ul>
<li>Abuser des retours à la ligne (<em>&lt;br /&gt;</em>). Préférez l&#8217;utilisation de paragraphe (<em>&lt;p&gt;</em>)</li>
<li>Multipliez les balises <em>&lt;div&gt;</em>. D&#8217;autres éléments peuvent être stylés à la manière de ces calques.</li>
<li>Utiliser <em>&lt;img /&gt;</em> pour des illustrations. Cette balise ne doit être utilisée que si elle apporte un complément d&#8217;information au texte de l&#8217;article.</li>
<li>Insérer du javascript dans le document. Tout le code JS doit être placé dans un fichier externe. C&#8217;est ce qu&#8217;on appelle le <a title="Voir un exemple sur le JDN" href="http://www.journaldunet.com/developpeur/tutoriel/dht/070119-js-unobstrusive-javascript-non-intrusif.shtml">javascript non-intrusif</a>.</li>
<li>Nommer les ID ou les class des différents éléments en fonction de la couleur qu&#8217;ils auront dans le document. Pensez que votre site pourra évoluer et donc que les couleurs pourront changer. Nommer donc vos balises selon leur sens sémantique et non selon leur apparence.</li>
<li>Insérer du style CSS dans le document avec <em>style=&nbsp;&raquo;"</em>. La feuille de style est là pour ça, pourquoi surcharger votre document ?</li>
</ul>
<p>Comme nous avons pu le constater, la création d&#8217;un document XHTML est soumise à un certain nombre de règle. A ces règles s&#8217;ajoutent ensuite <a title="Voir l'article qui explique comment rendre son site accessible" href="http://www.weblogr.fr/index.php/post/2008/01/26/Rendre-son-site-accessible">les contraintes d&#8217;accessibilités</a>. En respectant ces &laquo;&nbsp;normes&nbsp;&raquo;, vous garantissez à votre site d&#8217;être lu par différents supports. Être lu par le plus grand nombre, c&#8217;est bien ça le principe du web <img src='http://clearideaz.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h3>Pour aller plus loin</h3>
<p>Quelques liens qui apporteront un complément à ce billet :</p>
<ul>
<li><a title="Voir la documentation du W3C sur le XHTML" href="http://www.w3.org/TR/xhtml1/">Documentation du XHTML 1.0 par le W3C</a> (<a title="Voir la traduction de la documentation sur le XHTML par le W3C" href="http://www.la-grange.net/w3c/xhtml1/">traduction française</a>)</li>
<li><a title="Se rendre sur les articles d'Open Web à propos du XHTML" href="http://openweb.eu.org/xhtml/">Rubrique XHTML du site OpenWeb</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://clearideaz.com/2008/02/construire-un-document-xhtml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

