<?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>pockyworld :: le blog &#187; www</title>
	<atom:link href="http://blog.pockyworld.com/category/www/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pockyworld.com</link>
	<description>Le blog (qui brule plus que l'enfer)</description>
	<lastBuildDate>Wed, 11 Nov 2009 09:16:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>La création d’un site Internet de A à Z &#8211; Etape #5.3 : La construction d’un framework CSS &#8211; Gérer ses couleurs</title>
		<link>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-53-la-construction-d%e2%80%99un-framework-css-gerer-ses-couleurs/</link>
		<comments>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-53-la-construction-d%e2%80%99un-framework-css-gerer-ses-couleurs/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 13:47:09 +0000</pubDate>
		<dc:creator>pocky</dc:creator>
				<category><![CDATA[www]]></category>
		<category><![CDATA[couleur]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blog.pockyworld.com/?p=878</guid>
		<description><![CDATA[Aujourd&#8217;hui nous allons donc voir comment gérer ses couleurs via une feuille de style. Il n&#8217;y aura rien de compliqué en apparence mais c&#8217;est tout de même une étape importante. Pourquoi ? Parce que nous allons rentrer dans la problématique d&#8217;optimisation d&#8217;un CSS vis à vis d&#8217;une structure XHTML avec un cas concret qui va [...]]]></description>
			<content:encoded><![CDATA[<p>Aujourd&#8217;hui nous allons donc voir comment gérer ses couleurs via une feuille de style. Il n&#8217;y aura rien de compliqué en apparence mais c&#8217;est tout de même une étape importante. Pourquoi ? Parce que nous allons rentrer dans la problématique d&#8217;optimisation d&#8217;un CSS vis à vis d&#8217;une structure XHTML avec un cas concret qui va nous amener à réfléchir sur l&#8217;utilisation de la cascade.</p>
<h3>Le fichier color.css</h3>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&nbsp;
<span style="color: #808080; font-style: italic;">/*    --------------------------------------------------------------------
    [color.css]
&nbsp;
    Table of Contents
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1. Default Style
    2. Background
&nbsp;
&nbsp;
    My Colors
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    .black { color: #1b1b1b; }
    .SoftBlack { color: #282828; }
&nbsp;
    .white { color: #fefefe; }
&nbsp;
    .grey { color: #d4d4d4; }
    .softGrey { color: #f2f2f2; }
    .darkGrey { color: #545454;}
&nbsp;
    .red { color: #ff0000; }
    .darkRed { color: #b20202; }
&nbsp;
    .pink { color: #ff017d; }
    .darkPink { color: #87305a; }
&nbsp;
    .purple { color: #7a00c8; }
&nbsp;
    .blue { color: #053ba8; }
    .flashBlue { color: #44d1ff; }
    .darkBlue { color: #047ca3; }
&nbsp;
    .green { color: #029b02; }
    .flashGreen { color: #38d03c; }
    .darkGreen { color: #007857; }
&nbsp;
    .yellow { color: #ffcc00; }
&nbsp;
    .orange { color: #ff9600; }
    .softOrange { color: #ffae00; }
&nbsp;
    .brown { color: #8d3800; }
    .softBrown { color: #ca7700; }
    .darkBrown { color: #8d0000; }
&nbsp;
--------------------------------------------------------------------    */</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/*    --------------------------------------------------------------------   
    1. Default Style : because we need one :)
--------------------------------------------------------------------    */</span>
&nbsp;
body <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fefefe</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#1b1b1b</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
a<span style="color: #3333ff;">:link </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
a<span style="color: #3333ff;">:visited </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">purple</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">purple</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
a<span style="color: #3333ff;">:active </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*    --------------------------------------------------------------------   
    2. Background
--------------------------------------------------------------------    */</span>
&nbsp;
<span style="color: #6666ff;">.bgBlack</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#1b1b1b</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fefefe</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.bgWhite</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fefefe</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#1b1b1b</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Quoi c&#8217;est tout ?! Mais vous allez crier à l&#8217;arnaque <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<h4>Notre table des matières</h4>
<p>Petite nouveauté dans la table des matières, nous allons rajouter des informations concernant le design de notre site. Ceux qui ont connus les précédentes versions du pockyworld savent que si les images et moi ne font pas forcément bon ménage, ce n&#8217;est pas le cas des couleurs. J&#8217;adore les utiliser et en abuser. Étant donné que ma maquette est faite avant le framework, j&#8217;ai donc en poche la liste complète de ces couleurs et il me faut bien les noter quelques parts afin d&#8217;avoir un référentiel concret et éviter tout problème.</p>
<p>Ce référentiel trouve donc sa place dans le fichier color.css via les commentaires.</p>
<h4>1. Default Style : because we need one <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </h4>
<p>Comme à mon habitude, des styles par défaut. Un background blanc (mais pas tout à fait) et une police noire (mais pas tout à fait) feront l&#8217;affaire. Pourquoi pas tout à fait blanc ou tout à fait noire ? Simplement pour répondre au problème de contraste trop élevé qui abiment les yeux. N&#8217;avez vous jamais eu des sortes de &laquo;&nbsp;visions&nbsp;&raquo; après avoir consulté un site au fond noir ? Vous remarquerez d&#8217;ailleurs que certains ordinateurs (comme les macbook pro héhé) ajustent le niveau de luminosité de l&#8217;écran suivant la couleur dominante à l&#8217;instant T et la lumière environnante, le tout afin de préserver vos yeux.</p>
<p>Viennent ensuite les liens. Les liens peuvent être décomposés en 4 parties a:link, a:visited,a:hover et a:active. Pour vous souvenir de cette règle, pensez LoVe HAte (amour haine).</p>
<h4>2. Background</h4>
<p>Ma maquette initiale utilise deux couleurs de background, soit blanc, soit noir. Je vais donc les spécifier et au passage m&#8217;occuper de la couleur du texte. Tant qu&#8217;à faire, autant aller à l&#8217;essentiel.</p>
<h4>La totale</h4>
<p>Un <a href="http://mari.pocky.free.fr/bic/color.html#exemple1">petit fichier d&#8217;exemple</a> pour voir ce que cela peut donner.</p>
<h3>Maintenant, tous à vos neurones</h3>
<p>Alors maintenant question,  comment faire pour gérer mes couleurs de manière correcte sans me prendre la tête ? Vous avez pu voir que j&#8217;ai à gérer un nombre de couleurs relativement important puisque chacune des futures catégories du blog est associée à une couleur.</p>
<p>Coté XHTML, nous pouvons caractériser un article par les critères suivants :</p>
<ul>
<li>Un container général : par exemple le body (qui correspondra au div exemple2 dans l&#8217;exemple&#8230; 2)</li>
<li>Un div englobant l&#8217;article que nous appellerons entry</li>
<li>Une balise titre type h2 ou h3</li>
<li>Une date : entry-date</li>
<li>Une catégorie : entry-category</li>
<li>Un petit truc marrant qui identifie ma catégorie dans un span</li>
<li>Du contenu : entry-content</li>
<li>Des images, des liens,&#8230;</li>
<li>Un formulaire de commentaire</li>
<li>Les commentaires</li>
</ul>
<p>Du coté de CSS maintenant, nous avons donc deux informations :</p>
<ul>
<li>Les classes bgBlack ou bgWhite pour le background</li>
<li>Une classe correspondant à une catégorie et donc une couleur : cat-item-1</li>
</ul>
<p>Alors comment faire pour avoir mon background de couleur blanche, le formulaire de commentaire correctement intégré et tout mes liens, images, le petit truc marrant identifiant la catégorie et mon chapeau d&#8217;articles en rose ? Le tout sans me prendre la tête.</p>
<p>Place donc à la structure XHTML reprenant l&#8217;ensemble des éléments et nos classes. Attention, tout le CSS apparaissant dans style=&nbsp;&raquo;&#8230;.&nbsp;&raquo; ne sont la que parce que le framework n&#8217;est pas terminé <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . J&#8217;ai aussi du reprendre un peu le code pour que l&#8217;affichage reste correcte sur le blog, l&#8217;exemple est plus complet.</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;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cat-item-1 bgWhite&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;exemple2&quot;</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;entry&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;entry-meta&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;float: left; width: 460px; margin-right: 10px;&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cat-item-1&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;meta-separator&quot;</span>&gt;</span>\o/<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span> Catégorie 1<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;">p</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;float: left; width: 460px; margin-left: 10px; text-align: right&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;entry-date&quot;</span>&gt;</span>
			22 Octobre 2008<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>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;border-top: 1px solid; clear: both;&quot;</span>&gt;</span>Mon article<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;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;entry-content&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clear: both&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;alignCenter&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://blog.pockyworld.com/wp-content/uploads/vespa1.jpg&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;900px&quot;</span> <span style="color: #66cc66;">/</span>&gt;&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;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;alignJustify&quot;</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;uppercase verdana chapeau&quot;</span>&gt;</span>Le chapeau<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;">p</span>&gt;</span>Un petit texte<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;">div</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;form&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clear:both;&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;commentform&quot;</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;22&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Pseudo<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;22&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Mail<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;22&quot;</span>  <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Blog/site<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">textarea</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;comment&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;comment&quot;</span> <span style="color: #000066;">cols</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">rows</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;10&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">textarea</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Envoyer&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> 
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;comment&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<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;">form</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>Comme vous pourrez le voir, j&#8217;ai décidé de remonter mes deux classes <em>bgWhite</em> et <em>cat-item-1</em> au plus haut niveau. Je n&#8217;ai donc plus qu&#8217;à gérer ma cascade par rapport à ces éléments en CSS.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.bgWhite</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fefefe</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#1b1b1b</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.bgWhite</span> form input<span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.bgWhite</span> form textarea <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#d4d4d4</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#f2f2f2</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.cat-item-1</span> span<span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.cat-item-1</span> a<span style="color: #3333ff;">:link</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.cat-item-1</span> a<span style="color: #3333ff;">:visited</span><span style="color: #00AA00;">,</span>
<span style="color: #6666ff;">.cat-item</span> a<span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.cat-item</span> a<span style="color: #3333ff;">:active</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.cat-item-1</span> <span style="color: #6666ff;">.chapeau</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ff017d</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.cat-item-1</span> img <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ff017d</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Je m&#8217;occupe d&#8217;abord de mon background et du formulaire aux couleurs associés puis après de ma catégorie et donc des couleurs. Résultats des courses 4 lignes de CSS et un minimum de valeurs utilisées.<br />
Ayant 17 couleurs et 2 background, je pourrais gérer l&#8217;ensemble de mes couleurs en seulement 38 lignes de CSS contre un nombre beaucoup plus important (que je n&#8217;ai même pas envie de calculer) si j&#8217;avais choisi de rajouter une classe à chacun des liens, <em>span</em>, chapeau et image pour les gérer indépendamment les uns des autres. J&#8217;ai tellement du mal à voir m&#8217;imaginer la chose que je n&#8217;arrive d&#8217;ailleurs même pas à vous l&#8217;expliquer correctement alors beaucoup plus simple, l&#8217;opération se serais soldé un bordel monstrueux.</p>
<p>Pour un <a href="http://mari.pocky.free.fr/bic/color.html#exemple2">résultat visible ici</a> qui ne correspond pas forcément à la prochaine version du pockyworld (vous avez eu suffisamment d&#8217;informations pour aujourd&#8217;hui).</p>
<h4>Le bilan</h4>
<p>L&#8217;article du jour était donc pour moi l&#8217;occasion de vous inciter à penser votre code de manière correcte et simple. N&#8217;oubliez pas la règle KISS, Keep It Simple and Stupid, vous passerez donc environ 5 minutes à mettre sur une feuille vos balises XHTML puis trouver vos classes pour finalement avoir en résultat en&#8230; 2 minutes supplémentaires <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-53-la-construction-d%e2%80%99un-framework-css-gerer-ses-couleurs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>La création d’un site Internet de A à Z &#8211; Etape #5.2 : La construction d’un framework CSS &#8211; Coté typographie</title>
		<link>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-52-la-construction-d%e2%80%99un-framework-css-cote-typographie/</link>
		<comments>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-52-la-construction-d%e2%80%99un-framework-css-cote-typographie/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 11:33:47 +0000</pubDate>
		<dc:creator>pocky</dc:creator>
				<category><![CDATA[www]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[typographie]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.pockyworld.com/?p=868</guid>
		<description><![CDATA[Après l&#8217;article de la semaine dernière consacré aux fichiers master et clean d&#8217;un framework CSS, nous pouvons nous attaquer à la typo. Le fichier de typo appelé typography.css va donc avoir pour but de mettre en forme le texte. Nous retrouverons donc des choix de polices, de taille de texte ou encore d&#8217;effets mais c&#8217;est [...]]]></description>
			<content:encoded><![CDATA[<p>Après l&#8217;article de la semaine dernière consacré aux fichiers master et clean d&#8217;un framework CSS, nous pouvons nous attaquer à la typo. Le fichier de typo appelé typography.css va donc avoir pour but de mettre en forme le texte. Nous retrouverons donc des choix de polices, de taille de texte ou encore d&#8217;effets mais c&#8217;est surtout l&#8217;occasion d&#8217;enfoncer le clou une fois de plus en rappelant que l&#8217;organisation est le maitre mot d&#8217;un framework.</p>
<p>Et pas comme votre bureau dans lequel vous êtes le seul à vous retrouver.</p>
<p>Vous allez notamment voir apparaitre dans ce fichier des classes composées de plusieurs mots. Il est bien évidemment (comme dans tous langages de programmation) impossible de séparer un identifiant ou une classe en plusieurs mots. Il nous faut donc définir une sorte de règle permettant de s&#8217;y retrouver. Certains utiliserons le tirait -, d&#8217;autres l&#8217;underscore _ et en ce qui me concerne, la majuscule.</p>
<p>Il convient donc, une fois la règle établie de votre coté, de l&#8217;appliquer dans le temps <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Le fichier typography.css</h3>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------
	[typography.css]
&nbsp;
	Table of Contents
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	1. Default Style
	2. Heading
	3. Safe font family
	4. Text decoration
	5. Text align
	6. Typographic style
	7. Span me I'm famous!
&nbsp;
--------------------------------------------------------------------	*/</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------	
	1. Default Style : because we need one :)
--------------------------------------------------------------------	*/</span>
&nbsp;
body <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.2em</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.6em</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------	
	2. Heading
--------------------------------------------------------------------	*/</span>
&nbsp;
h1 <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">3em</span>/<span style="color: #933;">1.6em</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
h2 <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2.5em</span>/<span style="color: #933;">1.6em</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
h3 <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2em</span>/<span style="color: #933;">1.6em</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
h4 <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.8em</span>/<span style="color: #933;">1.6em</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
h5 <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.6em</span>/<span style="color: #933;">1.6em</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
h6 <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.4em</span>/<span style="color: #933;">1.6em</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------	
	3. Safe font family
--------------------------------------------------------------------	*/</span>
&nbsp;
<span style="color: #6666ff;">.arial</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Arial<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.courierNew</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'Courier New'</span><span style="color: #00AA00;">,</span> Courier<span style="color: #00AA00;">,</span> <span style="color: #993333;">monospace</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.georgia</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Georgia<span style="color: #00AA00;">,</span> <span style="color: #ff0000;">'Times New Roman'</span><span style="color: #00AA00;">,</span> Times<span style="color: #00AA00;">,</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.lucidaConsole</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'Lucida Console'</span><span style="color: #00AA00;">,</span> Monaco<span style="color: #00AA00;">,</span> <span style="color: #993333;">monospace</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.lucidaSansUnicode</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'Lucida Sans Unicode'</span><span style="color: #00AA00;">,</span> <span style="color: #ff0000;">'Lucida Grande'</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.tahoma</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Tahoma<span style="color: #00AA00;">,</span> Geneva<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.times</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'Times New Roman'</span><span style="color: #00AA00;">,</span> Times<span style="color: #00AA00;">,</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.trebuchet</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'Trebuchet MS'</span><span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.verdana</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Verdana<span style="color: #00AA00;">,</span> Geneva<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.msSans</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'MS Sans Serif'</span><span style="color: #00AA00;">,</span> Geneva<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.msSerif</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'MS Serif'</span><span style="color: #00AA00;">,</span> <span style="color: #ff0000;">'New York'</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.helvetica</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'Helvetica Neue'</span><span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.impact</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Impact<span style="color: #00AA00;">,</span> Charcoal<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------	
	4. Text decoration
--------------------------------------------------------------------	*/</span>
&nbsp;
<span style="color: #6666ff;">.underline</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">underline</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.strike</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">line-through</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------	
	5. Text align
--------------------------------------------------------------------	*/</span>
&nbsp;
<span style="color: #6666ff;">.alignLeft</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.alignRight</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.alignCenter</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.alignJustify</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">justify</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------	
	6. Typographic style
--------------------------------------------------------------------	*/</span>
&nbsp;
<span style="color: #6666ff;">.bold</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">900</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.light</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">100</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.italic</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">italic</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.smallcaps</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-variant</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">small-caps</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.expanded</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">letter-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #933;">.5em</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.condensed</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">letter-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-.1em</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.uppercase</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.lowercase</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">lowercase</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.capitalize</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">capitalize</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------	
	7. Span me I'm famous!
--------------------------------------------------------------------	*/</span>
&nbsp;
span<span style="color: #6666ff;">.first-letter</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">3.4em</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">.5em</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0.25em</span> <span style="color: #933;">0.14em</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<h3>Le fichier typography.css en détail</h3>
<p>Passons donc maintenant le fichier en revu. Certaines choses vont peut être vous plaire et d&#8217;autres non mais une fois de plus, ce fichier peut être adapté à votre sauce et c&#8217;est la tout l&#8217;intérêt. N&#8217;oubliez pas aussi le principe même des fichiers CSS, la dernière valeur indiquée est prioritaire sur toutes les autres.</p>
<h4>1. Default Style : because we need one <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </h4>
<p>La chose porte plutôt bien son nom car elle permet effectivement de spécifier une valeur par défaut pour le texte. Les valeurs font-size: 1.2em et line-height: 1.6em sont deux valeurs dont vous entendrez souvent parler pour une simple et bonne raison. En effet, associée au <em>html { font-size : 62.5% }</em> de <a href="http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-51-la-construction-dun-framework-css-master-et-reset/">clean.css</a> qui permet d&#8217;utiliser em de la même façon que px, elles permettent de régler les valeurs d&#8217;un texte à 12px de hauteur ainsi qu&#8217;un espace entre les lignes de 19.2px. Le tout dans un souci de visibilité pour ce cher lecteur.</p>
<h4>2. Heading</h4>
<p>Ah ces titres&#8230; Ceux qui sont tant sous-estimés voir mal utilisés. Petite piqure de rappelle donc, vous retrouverez en <em>html</em> 6 balises h<em>x</em>. Elles permettent de spécifier la hiérarchisation des titres et leurs niveaux d&#8217;importance. <em>h1</em> sera donc logiquement plus important que h6 qui sera le titre de plus bas niveau. Vous ne comprenez pas ? Ouvrez donc word (ou OpenOffice, soyons fou) et regardez la partie <em>style de texte</em>, vous retrouverez aussi ce principe de Titre, Titre 1, Titre 2 vous permettant de hiérarchiser votre document.</p>
<p>Grâce à CSS, nous allons donc styler nos titres du plus important au moins important. Pour l&#8217;instant le fichier typography.css ne fait que définir une taille de texte, un espacement et une police par défaut. Il va s&#8217;en dire que ces titres seront modifiés par la suite soient dans un autre fichier, soit directement via d&#8217;autres classes CSS. Cependant n&#8217;oubliez pas que CSS n&#8217;aura pas d&#8217;influence sur la balise au niveau sémantique. Ainsi, même si votre titre de niveau 6 fait 50 pixels de plus que votre titre de niveau 1, il sera toujours au niveau le plus bas d&#8217;un point de vue sémantique.</p>
<h4>3. Safe font family</h4>
<p>Une liste de classe CSS afin de définir des familles de polices. Pour trouver une famille de police qui tienne la route, rien bien compliqué. Sortez votre ami google et cherchez &laquo;&nbsp;safe font family&nbsp;&raquo; et la bonheur, des dizaines de sites répertories des familles de polices correctes. Il n&#8217;y a plus qu&#8217;à faire son choix !</p>
<h4>4. Text decoration | 5. Text align | 6. Typographic style</h4>
<p>La encore des séries de classes afin de modifier directement le texte. C&#8217;est à ce moment (selon moi) que vous pouvez comprendre tout l&#8217;intérêt du framework qui comme je l&#8217;avais précisé au début, est un framework fait pour l&#8217;intégrateur. Rappelez-vous, le mec qui a la maquette sous les yeux et qui doit se débrouiller pour faire la même chose en version html le plus rapidement possible car les personnes chargés du développement veulent commencer à intégrer leurs fonctionnalités dynamique <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Beaucoup de classes dans ces parties donc afin d&#8217;offrir un gain de temps conséquent.</p>
<p>Pour la petite histoire, vous retrouverez dans la partie 6 deux classes répondant au doux nom de <em>expanded</em> et <em>condensed</em>. Ces deux classes sont la pour rappeler la propriété <em>font-stretch</em> de CSS qui n&#8217;est malheureusement pas intégré dans les navigateurs&#8230; <em>expanded</em> et <em>condensed</em> s&#8217;amusent donc avec letter-spacing (espacement entre les lettres) pour combler ce manque.</p>
<p>Et pour ceux qui se poseraient la question, oui oui, on peut aussi régler l&#8217;espacement entres les mots avec word-spacing mais honnêtement, je ne vois pas vraiment d&#8217;utilité à la chose.</p>
<h4>7. Span me I&#8217;m famous!</h4>
<p>Alors la petit débat. J&#8217;utilise dans cette partie span.first-letter. Première entorse donc à ma règle concernant le nom des classes puisque je devrais utiliser span.firstLetter mais il y a une raison. Connaissez-vous les proprietés CSS2 :first-letter ou encore :first-line qui font partie de la famille des <em>pseudo-elements</em> ? Deux magnifiques inventions qui peuvent modifier votre première lettre ou votre première ligne de façon automatique. Deux magnifiques inventions qui malheureusement, ne sont pas comprises par IE6.</p>
<p>Dans un souci de compatibilité, certains utiliseront donc un span afin d&#8217;effectuer la tache. Les autres pourront se rabattre sur <a href="http://code.google.com/p/ie7-js/">un fix en javascript</a> permettant de modifier le comportement du navigateur et répondant au doux nom de IE7.js (ou IE8.js).</p>
<p>A noter qu&#8217;il existe un vrai débat autour de l&#8217;utilisation de ces deux fichiers javascript. Je les ai parfois utilisés, ils ont certains avantages et tout de même peu d&#8217;inconvénients mais en ce qui concerne le framework, je ne me suis pas encore posé la question puisque je ne prendrais ma décision une fois ce dernier terminé et un peu éprouvé. La pratique vous permettra cependant de voir que l&#8217;on peu facilement s&#8217;en passer. Enfin et pour ceux qui souhaiterais faire le test, vous pourrez vous apercevoir que :first-letter et span.first-letter peuvent avoir deux comportements différents avec les mêmes valeurs. Et oui, si c&#8217;était aussi facile&#8230;</p>
<p>Pour ceux qui voudraient voir les fichiers en action, vous pouvez aller voir sur <a href="http://mari.pocky.free.fr/bic">ce lien</a>. Vous pourrez donc vous apercevoir que exploit, notre premier bug de mise en page apparaitra sur le fameux <em>span.first-letter</em> sur les navigateurs de la famille Internet Explorer. Qu&#8217;est ce que vous voulez&#8230; On ne se refait pas mais rassurez-vous, tout sera fixé en temps et en heure.</p>
<p>La prochaine étape sera consacré à <em>color.css</em> qui sera avec <em>typography.css</em> le fichier de base que l&#8217;on n&#8217;hésitera pas à modifier pour l&#8217;adapter à ses besoins (contrairement à clean.css ou layout.css).</p>
<p>J&#8217;espère que le prochain billet arrivera plus vite que celui-ci <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .l</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-52-la-construction-d%e2%80%99un-framework-css-cote-typographie/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>La création d’un site Internet de A à Z &#8211; Etape #5.1 : La construction d&#8217;un framework CSS &#8211; Master et reset</title>
		<link>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-51-la-construction-dun-framework-css-master-et-reset/</link>
		<comments>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-51-la-construction-dun-framework-css-master-et-reset/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 12:54:21 +0000</pubDate>
		<dc:creator>pocky</dc:creator>
				<category><![CDATA[www]]></category>
		<category><![CDATA[bic]]></category>
		<category><![CDATA[clean]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[reset]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.pockyworld.com/?p=865</guid>
		<description><![CDATA[Si nous avons passé temps de temps à analyser les bonnes pratiques XHTML et CSS, c&#8217;est avant tout pour construire un framework CSS efficace répondant à nos besoins. L&#8217;étape 5 entame donc une série de billets sur la construction d&#8217;un framework CSS étape par étape. Vous pourrez y greffer vos commentaires afin d&#8217;y participer et/ou [...]]]></description>
			<content:encoded><![CDATA[<p>Si nous avons passé temps de temps à analyser <a href="http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-42-xhtml-et-css-bonnes-pratiques/">les bonnes pratiques XHTML et CSS</a>, c&#8217;est avant tout pour construire un framework CSS efficace répondant à nos besoins. L&#8217;étape 5 entame donc une série de billets sur la construction d&#8217;un framework CSS étape par étape. Vous pourrez y greffer vos commentaires afin d&#8217;y participer et/ou rectifier ce que je vais vous proposer.</p>
<p>Une fois l&#8217;étape 5 terminée, mon travail sera mis à la disposition de tous comme l&#8217;avait été <a title="Bic v1" href="http://www.alexandrebalmes.fr/webdesign/framework-css-bic/">le précédent</a>.</p>
<p>Pour la petite histoire, le framework BIC est un framework que j&#8217;ai à l&#8217;époque pensé pour l&#8217;intégrateur qui interviens donc avant le développement sur une maquette statique. Il consiste en un système de classe lui permettant de mettre en page plus rapidement tout en diminuant la longueur du CSS propre au site.</p>
<h3>Un peu de bonnes pratiques</h3>
<p>Avant d&#8217;aller plus loin, un peu de bonnes pratiques concernant la mise en page d&#8217;un framework. Un framework est un outil relativement complet, certaines choses seront couramment utilisées, d&#8217;autres moins. Reste qu&#8217;il faudra le documenter non seulement pour son utilisation mais aussi pour pouvoir le partager. Une fois fini, rien ne vous empêchera de le concaténer afin d&#8217;enlever tous les commentaires, les sauts de lignes et le rendre le plus léger possible mais en attendant&#8230; Il faut y voir clair.</p>
<h4>Organiser ses fichiers</h4>
<p>Un framework css est généralement articulés autour de plusieurs fichiers. Il peut y avoir un reset.css, un typography.css, un layout.css, un color.css ou je ne sais quoi encore mais vous noterez que mes exemples sont relativement précis, les mots sont parlants et vous savez à peu près ce que vous trouverez dans le fichier avant de l&#8217;ouvrir. N&#8217;oublier pas de ranger vos différents fichiers CSS dans un dossier que vous pourriez par exemple appeler&#8230; Hum&#8230; Pourquoi pas CSS ?</p>
<p>Un petit gain de temps pour vous (puisque vous en êtes l&#8217;auteur) mais un gros gain de temps pour les autres.</p>
<h4>Documenter</h4>
<p>La documentation est à la fois la chose la plus importante et la plus négligé. Une fois dans votre fichier entrain de fouiller dans vos 300 classes rangées à votre façon, vous vous perdrez vite et perdrez du temps inutilement. Important donc de bien utiliser le système de commentaire afin de partager votre fichier CSS en plusieurs parties de la même manière qu&#8217;un&#8230; livre pourquoi pas ? <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Histoire de remettre les choses en place et quitte à me répéter, un commentaire dans un fichier CSS se fait de la façon suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* &lt; --- l'ouverture du commentaire - la fin du commentaire ---&gt; */</span>
<span style="color: #808080; font-style: italic;">/* blablabla */</span></pre></div></div>

<h3>Première partie : le master</h3>
<p>La première partie donc, créer un fichier master. J&#8217;ai pour ma part choisis de le nommer <em>screen.css</em> afin de l&#8217;associer dans ma ligne xhtml aux medias screen et projection. Encore une fois, c&#8217;est relativement parlant et vous pourrez vous douter que le CSS pour gérer l&#8217;imprimante (et donc le media print) se nommera certainement <em>print.css</em>.</p>
<p>Dans ce premier fichier donc, la liste des différents fichiers CSS à appeler dans le répertoire /css/</p>
<p><em>screen.css</em></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*--------------------------------------------------------------------
&nbsp;
[Master Stylesheet]
&nbsp;
Framework : BIC
Version : 2
Last Change : 09/10/2008
Author : pocky
Please use for beautiful design only
&nbsp;
[Credits]
clean.css is inspired from Meyer : http://meyerweb.com
&nbsp;
--------------------------------------------------------------------*/</span>
&nbsp;
<span style="color: #a1a100;">@import &quot;css/clean.css&quot;;</span>
<span style="color: #a1a100;">@import &quot;css/typography.css&quot;;</span>
<span style="color: #a1a100;">@import &quot;css/color.css&quot;;</span>
<span style="color: #a1a100;">@import &quot;css/layout.css&quot;;</span>
<span style="color: #a1a100;">@import &quot;css/myclass.css&quot;;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Optional */</span>
<span style="color: #a1a100;">@import &quot;css/wordpress.css&quot;;</span></pre></div></div>

<p><strong><em>clean.css</em></strong> : Mon fichier clean.css est donc mon reset. Je ne souhaite pas m&#8217;arrêter au reset et redéfinis donc certaines choses à la suite du travail effectué par Eric Meyer. Je l&#8217;ai donc baptisé <em>clean.css</em> car il nettoie tout avec mes propres produits d&#8217;entretiens <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong><em>typography.css</em></strong> : La encore très simple, ce fichier se chargera des classes en rapport avec la typographie des pages web.</p>
<p><strong><em>color.css</em></strong> : Une série de classe associées à des couleurs les plus fréquemment utilisées par mes petites mains.</p>
<p><strong><em>layout.css</em></strong> : Un gros morceau dans ce fichier, une série de classes afin de faciliter la mise en page de la structure XHTML. Deux colonnes ou plus, tout va venir la dedans.</p>
<p><strong><em>myclass.css</em></strong> : Le fourre-tout du framework. Toutes les classes que je serais tenter de rajouter en vrac et au gré de mes humeurs.</p>
<p><strong><em>wordpress.css</em></strong> : Comme l&#8217;indique le commentaire au dessus, ce fichier est optionnel puisqu&#8217;il ne contiens que des classes utilisées par wordpress afin de faciliter la mise en page (par exemple des galeries).</p>
<h3>Allez op, nettoyez moi tout ça !</h3>
<p>Le fichier clean.css donc. Le but, remettre tout à zéro et nettoyer le reset à ma façon pour obtenir une base saine et donc&#8230; clean. Comme vous pourrez le constater, le fichier est documenté via une table des matières permettant de s&#8217;y repérer beaucoup plus simplement. Une fois de plus, c&#8217;est ma façon de faire mais vous pourrez très bien vous en inspirer <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------
	[clean.css]
&nbsp;
	Table of Contents
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	1. Meyer modified reset
	2. Body
	3. Tables
	4. Quotes
	5. List
	6. Links
	7. Anything else
--------------------------------------------------------------------	*/</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------	
	1. Meyer modified reset
--------------------------------------------------------------------	*/</span>
&nbsp;
&nbsp;
html<span style="color: #00AA00;">,</span> body<span style="color: #00AA00;">,</span> div<span style="color: #00AA00;">,</span> span<span style="color: #00AA00;">,</span> applet<span style="color: #00AA00;">,</span> object<span style="color: #00AA00;">,</span> iframe<span style="color: #00AA00;">,</span>
h1<span style="color: #00AA00;">,</span> h2<span style="color: #00AA00;">,</span> h3<span style="color: #00AA00;">,</span> h4<span style="color: #00AA00;">,</span> h5<span style="color: #00AA00;">,</span> h6<span style="color: #00AA00;">,</span> p<span style="color: #00AA00;">,</span> blockquote<span style="color: #00AA00;">,</span> pre<span style="color: #00AA00;">,</span>
a<span style="color: #00AA00;">,</span> address<span style="color: #00AA00;">,</span> big<span style="color: #00AA00;">,</span> cite<span style="color: #00AA00;">,</span> code<span style="color: #00AA00;">,</span>
del<span style="color: #00AA00;">,</span> dfn<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">,</span> img<span style="color: #00AA00;">,</span> ins<span style="color: #00AA00;">,</span> kbd<span style="color: #00AA00;">,</span> q<span style="color: #00AA00;">,</span> s<span style="color: #00AA00;">,</span> samp<span style="color: #00AA00;">,</span>
small<span style="color: #00AA00;">,</span> sub<span style="color: #00AA00;">,</span> sup<span style="color: #00AA00;">,</span> tt<span style="color: #00AA00;">,</span> var<span style="color: #00AA00;">,</span>
dl<span style="color: #00AA00;">,</span> dt<span style="color: #00AA00;">,</span> dd<span style="color: #00AA00;">,</span> ol<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> li<span style="color: #00AA00;">,</span>
fieldset<span style="color: #00AA00;">,</span> form<span style="color: #00AA00;">,</span> label<span style="color: #00AA00;">,</span> legend<span style="color: #00AA00;">,</span>
table<span style="color: #00AA00;">,</span> caption<span style="color: #00AA00;">,</span> tbody<span style="color: #00AA00;">,</span> tfoot<span style="color: #00AA00;">,</span> thead<span style="color: #00AA00;">,</span> tr<span style="color: #00AA00;">,</span> th<span style="color: #00AA00;">,</span> td <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">baseline</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
em<span style="color: #00AA00;">,</span> strong<span style="color: #00AA00;">,</span> strike<span style="color: #00AA00;">,</span> acronym <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">baseline</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* remember to define focus styles! */</span>
<span style="color: #3333ff;">:focus </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100.01</span>%</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
html <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">62.5</span>%</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------
	2. Body
--------------------------------------------------------------------	*/</span>
&nbsp;
body <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">min-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------
	3. Tables
--------------------------------------------------------------------	*/</span>
&nbsp;
table <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border-collapse</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">separate</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">border-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
caption<span style="color: #00AA00;">,</span> th<span style="color: #00AA00;">,</span> td <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------
	4. Quotes
--------------------------------------------------------------------	*/</span>
&nbsp;
blockquote<span style="color: #3333ff;">:before</span><span style="color: #00AA00;">,</span> blockquote<span style="color: #3333ff;">:after</span><span style="color: #00AA00;">,</span>
q<span style="color: #3333ff;">:before</span><span style="color: #00AA00;">,</span> q<span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------
	5. List
--------------------------------------------------------------------	*/</span>
&nbsp;
&nbsp;
ol<span style="color: #00AA00;">,</span> ul <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> list-type<span style="color: #00AA00;">:</span> <span style="color: #993333;">inside</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1em</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------
	6. Links
--------------------------------------------------------------------	*/</span>
&nbsp;
a<span style="color: #00AA00;">,</span> a img <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span> <span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #3333ff;">:focus </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">dotted</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*	--------------------------------------------------------------------
	7. Anything else
--------------------------------------------------------------------	*/</span>
&nbsp;
abbr <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">dotted</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1em</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">1em</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
hr <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-1px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<h4>Meyer modified reset</h4>
<p>Comme l&#8217;indique la table des matières et le crédit, la première partie du CSS est donc basée sur le reset d&#8217;<a href="http://meyerweb.com">Eric Meyer</a>. Seulement j&#8217;ai pris la peine de séparer le reset en deux parties pour les balises <em>em</em>, <em>strike</em>, <em>strong</em> et <em>accronym</em> afin de ne pas à avoir a redéfinir le font-style ou font-weight pour chacune d&#8217;entre elle.</p>
<p>Comme vous pouvez le voir en dessous, Meyer documente <em>:focus</em> en nous rappelant de penser à le définir. Pour information le focus est une pseudo-class CSS permettant de visualiser le lien en cours lors d&#8217;une navigation avec la touche tabulation ou lors du clic de souris (dans certains cas). Le focus est habituellement composé de pointillés autour de l&#8217;élément en cours.</p>
<p>Enfin des petites modifications pour combler un problème sur Internet Explorer <em>* { font-size: 100.01% }</em> et une autre pour pouvoir spécifier des hauteurs en em comme des px (pixels) <em>html { font-size: 62.5%; }</em></p>
<h4>Maintenant, on nettoie à notre sauce</h4>
<p>Place maintenant aux balises, je définis un peu de mise en page simple sur certaines balises sans pour autant m&#8217;attaquer au problème typographique. Normal, il sera effectué dans le fichier <em>typography.css</em>. On notera le retour de <em>:focus</em> afin de le redéfinir comme nous le conseil Meyer.</p>
<p>Vous pourrez aussi vous apercevoir que je n&#8217;ai que très peu concaténé mes valeurs afin de rencontrer le minimum de problème avec les navigateurs quel qu&#8217;ils soient. C&#8217;est une fois de plus un choix de ma part à ce niveau et valable uniquement pour ce fichier. Deux petites choses intéressantes encore, <em>body { min-height: 100%; }</em> afin d&#8217;éviter un problème de background sur certains navigateurs et enfin <em>hr { border: 0; height: 1px; margin-top: -1px; }</em>, un petit truc glané autour de quelques articles de blogs sur la balise hr afin une fois de plus de rencontrer le moins de problèmes avec cette balise qui pourra être redéfini via le fichier <em>myclass.css</em> pour la rendre toute kawai.</p>
<p>Prochain article consacré à <em>typography.css</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-51-la-construction-dun-framework-css-master-et-reset/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>La création d’un site Internet de A à Z &#8211; Etape #4.2 : XHTML et CSS, bonnes pratiques</title>
		<link>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-42-xhtml-et-css-bonnes-pratiques/</link>
		<comments>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-42-xhtml-et-css-bonnes-pratiques/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 14:08:44 +0000</pubDate>
		<dc:creator>pocky</dc:creator>
				<category><![CDATA[www]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blog.pockyworld.com/?p=848</guid>
		<description><![CDATA[Après l&#8217;article commencé hier et essentiellement consacré aux bonnes pratiques vis à vis de XHTML, nous pouvons nous pencher sur le cas des bonnes pratiques en CSS.
Avant de partir sur les bonnes pratiques, petit récapitulatif. Il existe trois façons d&#8217;intégrer du CSS, les deux premières sont directement incluse dans le fichier XHTML de structure et [...]]]></description>
			<content:encoded><![CDATA[<p>Après l&#8217;article commencé hier et essentiellement consacré aux<a href="http://blog.pockyworld.com/la-creation-dun-site-internet-de-a-a-z-etape-4-xhtml-et-css-bonnes-pratiques/"> bonnes pratiques vis à vis de XHTML</a>, nous pouvons nous pencher sur le cas des bonnes pratiques en CSS.</p>
<p>Avant de partir sur les bonnes pratiques, petit récapitulatif. Il existe trois façons d&#8217;intégrer du CSS, les deux premières sont directement incluse dans le fichier XHTML de structure et la troisième (celle des bonnes pratiques) dans fichier à l&#8217;extension <em>.css</em></p>
<h3>Comment utiliser du CSS dans une page web</h3>
<h4>Dans une balise avec l&#8217;attribut style</h4>
<p>Intégrer du CSS dans une balise doit rester quelque chose de ponctuel et d&#8217;exceptionnel. On pourrait par exemple s&#8217;en servir pour modifier un élément sans avoir accès au fichier CSS directement par exemple mais&#8230; A éviter.</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;">p</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;color: #ff017d&quot;</span>&gt;</span>Mon texte en rose<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span></pre></div></div>

<h4>Dans une page avec la balise style</h4>
<p>Second moyen de faire toujours dans une page, utiliser la balise. On retrouve donc une séparation de la structure et du CSS mais tout se trouve dans le même fichier. A éviter donc, quitte à séparer, autant utiliser deux fichiers.</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> <span style="color: #000066;">dir</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ltr&quot;</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fr-FR&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span> <span style="color: #000066;">profile</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://gmpg.org/xfn/11&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Exemple<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>&gt;</span>
		p { color: #ff017d; }
	<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>
&nbsp;
<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;">p</span>&gt;</span>Un texte en rose<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;">body</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<h4>Dans un fichier CSS</h4>
<p>Enfin une bonne façon de faire sur toute la ligne. En procédant de cette manière, la structure et la mise en page se font bien dans deux fichiers différents et indépendants l&#8217;un de l&#8217;autre. Il est donc possible de faire intervenir deux personnes différentes n&#8217;ayant pas directement accès à l&#8217;un ou l&#8217;autre des fichiers.</p>
<p>Cela se décompose en deux étapes, la première, le fichier XHTML de structure. Tout se passe dans la partie <em>head</em>.</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> <span style="color: #000066;">dir</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ltr&quot;</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fr-FR&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span> <span style="color: #000066;">profile</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://gmpg.org/xfn/11&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Exemple<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;">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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style.css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
&nbsp;
<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;">p</span>&gt;</span>Mon texte en rose<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;">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>

<p>Enfin un fichier CSS qui devra donc s&#8217;appeler dans mon cas <em>style.css</em></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ff017d</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Trois manières de faire pour un même résultat. N&#8217;est-ce pas franchement sympa ? <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Comment cibler un élément en CSS</h3>
<p>Il existe plusieurs moyens de cibler un élément.</p>
<p>Via le nom de sa balise afin de redéfinir tous les styles des balises XHTML :</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">body <span style="color: #00AA00;">&#123;</span> mes styles pour body<span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span> mes styles pour p<span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Via l&#8217;<em>id</em> afin de cibler un élément unique dans la page :</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;paragraphe&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>blablabla<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></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#paragraphe</span> <span style="color: #00AA00;">&#123;</span> mes styles pour parapgrahe <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#paragraphe</span> p <span style="color: #00AA00;">&#123;</span> mes styles pour p dans le div paragraphe <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Via les <em>class</em> qui peuvent être utilisés autant de fois que nous le souhaitons sur une page :</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;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;paragraphe&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>blablabla<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>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;paragraphe2&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>blablabla<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>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;paragraphe&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>blablabla<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></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.paragraphe</span> <span style="color: #00AA00;">&#123;</span> mes styles pour <span style="color: #6666ff;">.parapgrahe</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.paragraphe</span> p <span style="color: #00AA00;">&#123;</span> mes styles pour p dans <span style="color: #6666ff;">.paragraphe</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.paragraphe2</span> <span style="color: #00AA00;">&#123;</span> mes styles pour <span style="color: #6666ff;">.parapgrahe2</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.paragraphe2</span> p <span style="color: #00AA00;">&#123;</span> mes styles pour p dans <span style="color: #6666ff;">.paragraphe2</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Trois possibilités donc avec lesquelles il faudra apprendre à jongler. Essayez cependant de limiter le nombre d&#8217;<em>id</em> au profit de <em>class</em> pour assurer une plus grande flexibilité du code.</p>
<h3>Bonnes pratiques</h3>
<p>La partie introduction terminée, penchons nous sur les bonnes pratiques associées à l&#8217;utilisation des CSS.</p>
<h4>Inclure correctement un fichier CSS</h4>
<p>Comme nous l&#8217;avons vu plus haut, nous utilisons <em>link</em> associé à l&#8217;attribut <em>type</em>, <em>rel</em> et <em>href</em> pour inclure correctement un fichier CSS. Seulement voila, mon code plus haut n&#8217;est pas forcément le meilleur. En effet et après un peu de pratique vous pourrez vous apercevoir qu&#8217;un attribut supplémentaire baptisé <em>media</em> peut venir chambouler les choses.</p>
<p>Il existe donc plusieurs types de media, par media comprenez interface de visualisation. CSS prends donc tout cela en charge afin d&#8217;optimiser voir de changer tout votre design suivant le type de périphérique connecté sur votre site.</p>
<p>La liste complète :</p>
<ul class="notype">
<li><strong>all</strong> : Cela porte plutôt bien son nom, tous les medias sont concernés par all</li>
<li><strong>screen</strong> : Un écran d&#8217;ordinateur</li>
<li><strong>print</strong> : Une imprimante</li>
<li><strong>projection</strong> : Un vidéo projecteur</li>
<li><strong>handled</strong> : Un périphérique portable de type pocketpc ou palm</li>
<li><strong>tv</strong> : Les écrans de télévisions</li>
<li><strong>aural</strong> : Pour les lecteurs vocaux</li>
<li><strong>braille</strong> : Les appareils à retour tactiles</li>
<li><strong>embossed</strong> : Les imprimantes brailles</li>
<li><strong>tty</strong> : Les petits périphériques portables à la navigation limitée</li>
</ul>
<p>Autant de médias, autant de possibilités. La simplicité rimerais donc à spécifier <em>all</em> et à ne pas trop se poser de questions. Malheureusement, nous aimons bien réfléchir un peu et pourquoi pas optimiser pour les différents medias par 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;">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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style/style.css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;screen, projection&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>Ainsi nous disons : Si tu es un media de type ordinateur ou vidéo-projecteur, charge le fichier style.css dans le répertoire style. Pourquoi dire screen et projection ? Tout simplement car Opera en plein écran est un media de type projection. Il serait bête de ne plus voir de CSS dans ce cas <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Seconde optimisation (et nous aurons fait le tour des plus courantes), l&#8217;imprimante. Reprenons donc notre code et ajoutons lui une ligne.</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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style/style.css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;screen, projection&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style/print.css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;print&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>Deux fichiers différents seront donc chargés. style/style.css dans le cas d&#8217;un média de type écran ou vidéoprojecteur et le fichier style/print.css dans le cas d&#8217;une imprimante. Le minimum syndical est donc fait, nous pourrions en plus (vu la démocratisation) nous intéresser au périphérique mobile pour avoir le minimum syndicale de 2009 <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Quant aux autres types de médias, ils n&#8217;auront alors aucun fichier de style mais par moment, cela n&#8217;est pas forcément une lacune. Bien au contraire.</p>
<h4>Remettre sur un pied d&#8217;égalité l&#8217;ensemble des navigateurs</h4>
<p>Une fois nos CSS correctement déclarés dans la structure XHTML, il faut se poser la questions des navigateurs. Un peu de pratique vous mettra donc devant le fait accompli : les navigateurs ne sont pas tous sur un pied d&#8217;égalité concernant CSS. Pourquoi ? Parce qu&#8217;il ne respecte pas de la même manière les standard du web.</p>
<p>La meilleure façon de faire est donc de remettre l&#8217;ensemble des valeurs par défauts et donc tout à 0. Cela s&#8217;appelle le reset et un peu de recherche sur google vous conduira vers une tonne de ressource consacrées au reset css dont <a href="http://www.css4design.com/blog/5-reset-css-a-la-loupe-pour-une-remise-a-zero-des-valeurs-par-defaut-des-navigateurs">css4design</a> (le retour de ce cher br1o) qui a décrypté plusieurs façons de faire. N&#8217;aimant pas réinventer la roue, allez donc faire un tour du coté de son site.</p>
<h4>Éviter les hacks CSS inutiles</h4>
<p>Une fois remise à zéro, vous vous apercevrez toujours que certains éléments ne sont pourtant pas correct sur tous les navigateurs. La tentation est donc grande de procéder à un <em>hack css</em> pour rectifier la valeur simplement</p>
<p>Prenons par exemple un problème de marge sur Internet Explorer 6. IE6, le meilleur ami de l&#8217;intégrateur&#8230; Ou pas. Nous avons donc fait un CSS qui s&#8217;affiche correctement sur Firefox et Opera mais pas sur IE6, nous pouvons alors utiliser la règle !important.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">15px</span> !important<span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Ainsi, IE6 ne n&#8217;aura que 10px à gauche et à droite du #container alors que Firefox en utilisera 15.</p>
<p>Seulement, la chose à ces limites et !important ainsi que tous les hacks CSS ont toujours leurs limites. Les bonnes pratiques consistent donc à utiliser une autre règle afin de dire au navigateur d&#8217;ouvrir ou non certains fichiers CSS et ainsi rectifier le CSS correctement et explicitement (dans un autre fichier). Nous procéderons donc de la façon suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--[if IE ]&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;link rel=&quot;stylesheet&quot; href=&quot;css/ie.css&quot; type=&quot;text/css&quot; /&gt;</span>
<span style="color: #808080; font-style: italic;">&lt; ![endif]--&gt;</span></pre></div></div>

<p>Ainsi si le visiteur utilise IE, le fichier ie.css sera automatiquement chargé. Il existe d&#8217;autres utilisation de if comme gt (greather than), lt (lower than) ou gte/lte (greather than or equal/lower than or equal) pour les différentes version d&#8217;un navigateur IE 6, IE 5, IE 7 ou même plus tard IE8.</p>
<h4>Un CSS pour les dominer tous</h4>
<p>Nous reviendrons sur le problème plus tard mais utiliser un fichier master css qui appelle d&#8217;autres fichiers css a quelques avantages. En effet si l&#8217;on reprends le code suivant :</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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style/style.css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;screen, projection&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<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;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;style/print.css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;print&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>Nous pouvons nous poser la question suivante Vais-je utiliser un master css ou non ? J&#8217;aurais tendance à dire oui. Prenons le cas de notre fichier de reset amicalement baptisé <em>reset.css</em>. Il sera tout aussi important dans le cas de l&#8217;affichage sur un écran que sur une simple feuille de papier alors pourquoi le copier coller deux fois ? Autant le mettre à part et l&#8217;appeler de la façon suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@import url(&quot;css/reset.css&quot;);</span></pre></div></div>

<p>Puis de procéder ainsi pour un ensemble de fichier. Un gain de temps non négligeable, surtout pour les personnes pointilleuses avec la mise en page.</p>
<h4>Utiliser une librairie CSS afin d&#8217;accélérer la mise en page</h4>
<p>Tout le monde à l&#8217;habitude d&#8217;utiliser des classes CSS et de s&#8217;en fabriquer quelques unes afin d&#8217;accélérer l&#8217;intégration alors pourquoi ne pas en profiter ? Nous pourrions par exemple très simplement créer un fichier css répondant au doux nom de <em>classe.css</em> et incorporer des éléments redondants comme par exemple :</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.FloatLeft</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.FloatRight</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.Clear</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.Border</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Ne reste donc plus qu&#8217;à inclure notre fichier <em>class.css</em> dans notre <em>master.css</em>.</p>
<h4>Commenter son CSS et l&#8217;organiser</h4>
<p>Un fichier CSS peut rapidement devenir un grand n&#8217;importe quoi. Il est donc important de commenter votre feuille de style et l&#8217;organiser correctement. Il n&#8217;y a malheureusement pas grand chose d&#8217;autres à dire, tout dépend de l&#8217;individu. Vous pouvez cependant commenter les parties comme générale, header, sidebar, footer afin de vous repérer ou encore indenter votre code CSS.</p>
<p>Pour ma part je nomme les parties dans mon fichier css mais n&#8217;indente pas et tape tout sur une ligne (à moins d&#8217;avoir beaucoup de valeur). C&#8217;est ma façon de faire et je m&#8217;y retrouve très bien <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*------------------------------------------------------*/</span>
<span style="color: #808080; font-style: italic;">/*--------- Un exemple de commentaire en css --------*/</span>
<span style="color: #808080; font-style: italic;">/*------------------------------------------------------*/</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>ou</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> 
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<h4>Concaténer les valeurs</h4>
<p>Nous pouvons concaténer certaines valeurs en css afin de gagner quelques lignes et au passage, se prendre un peu moins la tête. Par exemple pour une marge, je peux aussi bien faire :</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>que</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>ou encore</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Ceci est valable pour définir <em>margin</em>, <em>padding</em>, <em>font</em> et <em>border</em>.</p>
<p>Exemple pour margin (même chose pour padding):</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #000000; font-weight: bold;">right</span> <span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">top</span>/<span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #000000; font-weight: bold;">right</span>/<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">top</span>/<span style="color: #000000; font-weight: bold;">bottom</span>/<span style="color: #000000; font-weight: bold;">right</span>/<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Pour border :</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">width</span> style <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ff017d</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Pour background :</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">color</span> image <span style="color: #993333;">repeat</span> attachment <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f00</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">background.gif</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #993333;">fixed</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Pour font :</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">font-style</span> <span style="color: #00AA00;">&#40;</span><span style="color: #993333;">italic</span>/<span style="color: #993333;">normal</span><span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">font-variant</span> <span style="color: #00AA00;">&#40;</span><span style="color: #993333;">small-caps</span><span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">font-weight</span> <span style="color: #000000; font-weight: bold;">font-size</span>/<span style="color: #000000; font-weight: bold;">line-height</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">italic</span> <span style="color: #993333;">small-caps</span> <span style="color: #993333;">bold</span> <span style="color: #933;">1em</span>/<span style="color: #933;">1.6em</span> <span style="color: #ff0000;">&quot;Lucida Grande&quot;</span><span style="color: #00AA00;">,</span><span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<h4>Éviter le trop noir ou le trop blanc</h4>
<p>Vous pouvez éviter d&#8217;utiliser #000000 pour du noir (au passage cela peut aussi s&#8217;écrire #000) et #ffffff pour du blanc (#fff) afin de protéger les écrans et les yeux de vos lecteurs.</p>
<p>On utilisera donc par exemple #fefefe pour du blanc cassé et #1b1b1b pour du noir pas tout à fait noir <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<h4>Penser sa cascade</h4>
<p>CSS c&#8217;est avant tout Cascading StyleSheet. Tout fonctionne en cascade de haut en bas. Si je modifiais 10 fois ma balise p en mettant autant de couleur différente, seule la dernière ligne serait interprétée. A contrario, je peux définir une première fois des valeurs globales puis affiner au fur et à mesure comme par exemple :</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">body <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1em</span>/<span style="color: #933;">1.6em</span> <span style="color: #ff0000;">&quot;Lucida Grande&quot;</span><span style="color: #00AA00;">,</span><span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
a <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ff017d</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">border-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ff017d</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Toute ma page respectera donc la taille 1em avec 1.6em d&#8217;interligne dans la police Lucida Grande, mes paragraphes auront 10px de marge en haut et en bas et mes liens seront roses. Rien ne sert de spécifier à chaque fois la taille de ma police, cela est déjà fait. J&#8217;utilise donc la cascade comme il se doit.</p>
<p>Je pourrais tout aussi bien prendre le même code :</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">body <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1em</span>/<span style="color: #933;">1.6em</span> <span style="color: #ff0000;">&quot;Lucida Grande&quot;</span><span style="color: #00AA00;">,</span><span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
a <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ff017d</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">border-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ff017d</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> arial<span style="color: #00AA00;">,</span> verdana<span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Et faire la même chose pour ne modifier que la police des liens pour utiliser arial.</p>
<h4>Définir une famille de police</h4>
<p>Sans pour autant rentrer dans le débat des différents choix de police, pensez à utiliser une famille de police plutôt qu&#8217;une police seule. En effet un visiteur ne possédant pas la première police passera automatiquement à la suivante puis la troisième et ainsi de suite. Cela reflète aussi l&#8217;importance d&#8217;utiliser des polices de type web.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Arial<span style="color: #00AA00;">,</span> Verdana<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<h3>Et la suite ?</h3>
<p>Je vous propose tout simplement de passer aux commentaires afin de laisser vos propres bonnes pratiques. Nous pourrions par exemple aborder le sujet des 100,01%, des 62,5% pour utiliser em comme px et de pleins d&#8217;autres choses. Les bonnes pratiques CSS méritent à elles seules 3 chapitres <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Nous en reparlerons cependant très vite avec la construction d&#8217;une librairie CSS reprenant l&#8217;ensemble des bonnes pratiques.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-42-xhtml-et-css-bonnes-pratiques/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>La création d&#8217;un site Internet de A à Z &#8211; Etape #4.1 : XHTML et CSS, bonnes pratiques</title>
		<link>http://blog.pockyworld.com/la-creation-dun-site-internet-de-a-a-z-etape-4-xhtml-et-css-bonnes-pratiques/</link>
		<comments>http://blog.pockyworld.com/la-creation-dun-site-internet-de-a-a-z-etape-4-xhtml-et-css-bonnes-pratiques/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 12:09:51 +0000</pubDate>
		<dc:creator>pocky</dc:creator>
				<category><![CDATA[www]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blog.pockyworld.com/?p=827</guid>
		<description><![CDATA[Après une série de billets pour le &#171;&#160;grand public&#160;&#187;, nous voici dans la nouvelle série consacré aux professionnels du web amenés à écrire des lignes de codes XHTML et CSS. Comme tout ce qui constitue l&#8217;outil Internet, faire des lignes de codes est potentiellement donné à toutes les personnes se donnant la peine d&#8217;étudier les [...]]]></description>
			<content:encoded><![CDATA[<p>Après une série de billets pour le &laquo;&nbsp;grand public&nbsp;&raquo;, nous voici dans la nouvelle série consacré aux professionnels du web amenés à écrire des lignes de codes <acronym title="eXtensible HyperText Markup Language" lang="uk">XHTML</acronym> et <acronym title="Cascading style sheet" lang="uk">CSS</acronym>. Comme tout ce qui constitue l&#8217;outil Internet, faire des lignes de codes est potentiellement donné à toutes les personnes se donnant la peine d&#8217;étudier les différents langages de programmations.</p>
<p>Une fois de plus, deux types de personnes vont donc se démarquer : <strong>ceux qui font du web &laquo;&nbsp;sexy&nbsp;&raquo; et les autres</strong>.</p>
<h3>Ressources</h3>
<p>Les ressources à ce niveau ne sont ni chères ni compliquées. Pour les personnes qui préfèrent avoir quelque chose en main, les mémentos <a href="http://www.eyrolles.com/Informatique/Livre/9782212119558/livre-memento-xhtml.php" title="mémento xhtml chez eyrolles">XHTML</a> et <a href="http://www.eyrolles.com/Informatique/Livre/9782212117264/livre-memento-css.php" title="mémento CSS chez eyrolles">CSS</a> seront vos plus fidèles alliés. Pour les autres, deux sites internet peuvent par exemple servir de bible à savoir <a href="http://xhtml.le-developpeur-web.com/" title="la bible xhtml">X H T M L</a> et <a href="http://wiki.mediabox.fr/documentation/css" title="le site mediabox">mediabox</a>.</p>
<h3>XHTML et CSS, mécékoica ?</h3>
<p>Essayons de faire la chose simple en comparant à quelque chose de connue comme Word. Lorsque vous créez un document Word, vous avez deux moyens de faire.</p>
<p>Le premier étant de créer votre document puis de passer sur chacun de vos éléments afin de mettre en page votre document. Bilan : long, fastidieux et pas toujours cohérents du début à la fin. Voici l&#8217;exemple du web comme il ne doit plus être, un seul élément pour tout définir le tout, très compliqué à maintenir correctement et peu ouvert aux collaborateurs.</p>
<p>Seconde option, taper votre document au kilomètre sans vous soucier d&#8217;autres choses que de la structure. Faire des paragraphes, mettre vos titres de niveau 1, puis 2, puis 3, vos listes et tutiquanti. Une fois l&#8217;opération terminée, utiliser les styles du document et les définir pour chacun des éléments de votre document. Enfin, les appliquer. Si vous faites de cette manière, vous voila dans le web actuel, celui que tout le monde devrait faire et divisé en deux parties : la structure (HTML ou XHTML) et le fichier de style (CSS).</p>
<h3>Pour un web plus &laquo;&nbsp;sexy&nbsp;&raquo;</h3>
<p>Faire des lignes de codes sexy est une véritable mentalité et un réflexe qui devrait être présent chez chacun des intervenants amenés à écrire une ligne de code. Voici quelques avantages à rendre du code sexy.</p>
<h4>Faciliter la lecture du code</h4>
<p>Prenons un exemple trouvé lors d&#8217;une de mes lectures de la semaine dernière. Le bout de code XHTML suivant se trouve sur le blog des <a href="http://microformateurs.org/">microformateurs</a>. Les microformateurs sont un groupe réunis autour d&#8217;un même but, faire découvrir les microformats au plus grand nombre et par la même occasion, la sémantique sur le web.</p>

<div class="wp_syntax"><div class="code"><pre class="xhtml" style="font-family:monospace;">&lt;div class=&quot;vcard&quot;&gt;
&lt;div class=&quot;fn&quot;&gt;Christophe Ducamp&lt;/div&gt;
&lt;div class=&quot;adr&quot;&gt;
&lt;span class=&quot;locality&quot;&gt;Paris&lt;/span&gt;,
&lt;span class=&quot;country-name&quot;&gt;France&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</pre></div></div>

<p>Comme vous pourrez facilement vous en apercevoir, se retrouver dans ce petit code n&#8217;est pas forcément facile. La raison : il n&#8217;est pas indenté. La première étape vers un code plus sexy est donc l&#8217;indentation du code afin de rendre la lecture pour les différents intervenants plus facile. Le même code indenté donne donc la chose suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="xhtml" style="font-family:monospace;">&lt;div class=&quot;vcard&quot;&gt;
	&lt;div class=&quot;fn&quot;&gt;Christophe Ducamp&lt;/div&gt;
	&lt;div class=&quot;adr&quot;&gt;
		&lt;span class=&quot;locality&quot;&gt;Paris&lt;/span&gt;,
		&lt;span class=&quot;country-name&quot;&gt;France&lt;/span&gt;
	&lt;/div&gt;
&lt;/div&gt;</pre></div></div>

<p>Ce n&#8217;est pas très compliqué non ? Des tabulations correctement placées nous permettent de lire plus facilement le code et de séparer visuellement les différents éléments de la page.</p>
<h4>Utiliser les bonnes balises aux bons endroits</h4>
<p>Toujours en nous basant sur le code précédent, nous pouvons nous poser la question du balisage XHTML utilisé. Il utilise en l&#8217;occurrence la balise <em>div</em> représentant un conteneur générique neutre de type bloc (oui ça se complique). Le balisage utilisé est donc en soit acceptable. Seulement pour ma part et pour beaucoup d&#8217;intégrateurs, le choix de l&#8217;imbrication de plusieurs <em>div</em> n&#8217;est pas forcément une bonne solution, non seulement car cela n&#8217;a pas beaucoup de sens mais en plus car cela peut causer bien des problèmes selon les navigateurs employés.</p>
<p>Opter pour un bon balisage permet donc de donner du sens à la structure en l&#8217;identifiant d&#8217;une manière correcte et significative. Nous pourrions par exemple dans ce cas (une carte de visite) utiliser une liste non-numéroté avec la balise <em>ul</em> et les éléments de liste <em>li</em>. Pourquoi ces balises ? Car une carte de visite n&#8217;est après tout qu&#8217;un ensemble d&#8217;informations listées et utilisées afin de désigner un individu.</p>

<div class="wp_syntax"><div class="code"><pre class="xhtml" style="font-family:monospace;">&lt;ul class=&quot;vcard&quot;&gt;
	&lt;li class=&quot;fn&quot;&gt;Christophe Ducamp&lt;/li&gt;
	&lt;li class=&quot;adr&quot;&gt;
		&lt;ul&gt;
			&lt;li class=&quot;locality&quot;&gt;Paris&lt;/li&gt;
			&lt;li class=&quot;country-name&quot;&gt;France&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;</pre></div></div>

<h4>Penser aux autres</h4>
<p>Une autre étape dans la mise en place dans code plus sexy est tout simplement l&#8217;accessibilité. Par accessibilité nous entendons accessibilité aux informations. Pourquoi ? Car les personnes handicapées représentent tout de même environ 1 personne sur 10 en Europe. Vous vous devez, en tant que professionnel du web penser à ces personnes car ils ont comme tout le monde le droit de visiter votre site internet. Sans tomber dans l&#8217;extrême, il est tout simplement utile de noter qu&#8217;un site associant XHTML et CSS former autour de bonnes pratiques et de bon balisage répondra environ au trois quarts des demandes du <a href="http://rgaa.dgme.fr/index.php/front/web/points_de_controle" title="le site du RGAA">référentiel général d&#8217;accessibilité des administrations</a>. Le dernier quart étant essentiellement constitué de problématiques associées à la bonne dégradation du javascript (vive le web 2.0) et les pratiques vraiment spécifiques à l&#8217;accessibilité comme l&#8217;utilisation des attributs <em>lang</em>, des <em>accesskey</em> ou encore de <em>tabindex</em> (tabindex dont vous pourriez même vous passer en faisant correctement votre travail). Notons que ces attributs spécifiques à l&#8217;accessibilité sont tout aussi facile à mettre en place et ne sont donc qu&#8217;un simple coup de main à prendre.</p>
<p>Prenons le cas de <em>lang</em>. L&#8217;attribut <em>lang</em> est à utiliser lorsque l&#8217;on veut spécifier la langue utilisée dans la balise en cours. Elle sert en plus à assister le navigateur dans le choix du type de guillemet ou encore à assister les vérificateurs de grammaire et d&#8217;orthographe. Coté accessibilité, l&#8217;utilisation de <em>lang</em> permet aux synthétiseurs vocaux d&#8217;utiliser la bonne voix et donc la bonne intonation/le bon accent.</p>
<p>Je définis donc dans un premier temps la langue utilisée sur mon site, le Français de France (et non pas le Français du Canada par exemple qui serait fr-CA)</p>

<div class="wp_syntax"><div class="code"><pre class="xhtml" style="font-family:monospace;">&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; dir=&quot;ltr&quot; lang=&quot;fr-FR&quot;&gt;
&lt;/html&gt;</pre></div></div>

<p>Mais dans mon contenu, au grès des articles, je pourrais très bien citer Sir Richard Steele avec la citation suivante en anglais :</p>

<div class="wp_syntax"><div class="code"><pre class="xhtml" style="font-family:monospace;">&lt;p lang=&quot;uk&quot;&gt;
	&lt;q&gt;Reading is to the mind what exercise is to the body.&lt;/q&gt;
	&lt;cite&gt;Sir Richard Steele&lt;/cite&gt;
&lt;/p&gt;</pre></div></div>

<p>Modifier la langue pour qu&#8217;un lecteur vocal puisse effectuer son travail correctement ? Parfaitement inutile pour 99% du web. Utile pour le pourcentage restant. Non, très utile pour le pourcentage restant.</p>
<h4>Sémantiquement votre</h4>
<p>Dernière étape, optionnelle certes, s&#8217;ouvrir aux futurs technologies comme celles du web sémantique. Deux possibilité Microformats et RDFa s&#8217;offrent donc à vous. Ne rentrons pas dans le débat tout de suite mais occupons nous du principal avantage procuré par ces technologies : l&#8217;ouverture.</p>
<p>Utiliser l&#8217;une ou l&#8217;autre de ces technologies et les mettre en place permet donc de se faire comprendre et de donner un sens sémantique à son contenu. L&#8217;exemple le plus concret étant celui du &laquo;&nbsp;sac de patate&nbsp;&raquo; dont use et abuse les enseignants de mathématiques afin d&#8217;obliger les élèves à préciser la nature exacte d&#8217;un nombre. Le parallèle peut donc être fait avec le web, reprenons pour cela notre carte de visite qui est donc microformaté (l&#8217;une des deux manières de faire) :</p>

<div class="wp_syntax"><div class="code"><pre class="xhtml" style="font-family:monospace;">&lt;ul class=&quot;vcard&quot;&gt;
	&lt;li class=&quot;fn&quot;&gt;Christophe Ducamp&lt;/li&gt;
	&lt;li class=&quot;adr&quot;&gt;
		&lt;ul&gt;
			&lt;li class=&quot;locality&quot;&gt;Paris&lt;/li&gt;
			&lt;li class=&quot;country-name&quot;&gt;France&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;</pre></div></div>

<p>Comme vous pourrez le voir, cette petite carte de visite contiens un nom, un prénom, une ville et un pays. Mais comment le dire à un ordinateur ? Réponse proposée par les microformats, utiliser les classes CSS. Ainsi <em>vcard</em>, <em>fn</em>, <em>adr</em>, <em>locality</em>, <em>country-name</em> sont autant de microformats compris par certains outils comme les moteurs de recherche.</p>
<h4>La finalité</h4>
<p>Nous avons donc rendu notre code plus lisible, lui avons donné une structure correcte, nous l&#8217;avons rendu accessible et enfin, nous lui avons donné un sens. Mais dans quel but ? Réponse simple, le référencement naturel et donc 90% du travail qui permettra de vous faire comprendre par l&#8217;ensemble du web et ainsi vous mettre en avant d&#8217;une façon correcte et pertinente. Ah ce référencement, un mot tellement simple qui fera plaisir à plus d&#8217;un décideur&#8230;</p>
<p><em>Prochaine étape, le CSS&#8230;</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pockyworld.com/la-creation-dun-site-internet-de-a-a-z-etape-4-xhtml-et-css-bonnes-pratiques/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>La création d’un site internet de A à Z &#8211; Etape 3 : le choix de l&#8217;hébergeur</title>
		<link>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-3-le-choix-de-lhebergeur/</link>
		<comments>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-3-le-choix-de-lhebergeur/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 13:57:37 +0000</pubDate>
		<dc:creator>pocky</dc:creator>
				<category><![CDATA[www]]></category>
		<category><![CDATA[hébergement]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.pockyworld.com/?p=824</guid>
		<description><![CDATA[Continuons sur notre lancée pour choisir notre hébergeur. Dans le chapitre précédent nous avions pu voir que chacune des solutions open-source sont généralement accompagnées d&#8217;informations concernant les spécifications techniques de l&#8217;hébergement. Prochain travail donc, trouver l&#8217;hébergeur de confiance.
Nous pouvons diviser le chapitre de l&#8217;hébergement en trois catégories : le mutualisé, le serveur virtuel et le [...]]]></description>
			<content:encoded><![CDATA[<p>Continuons sur notre lancée pour choisir notre hébergeur. <a href="http://blog.pockyworld.com/la-creation-d%E2%80%99un-site-internet-de-a-a-z-etape-22-mais-euh-cest-quoi-ces-trucs-wordpressjoomla-ou-encore-oscommerce/">Dans le chapitre précédent</a> nous avions pu voir que chacune des solutions open-source sont généralement accompagnées d&#8217;informations concernant les spécifications techniques de l&#8217;hébergement. Prochain travail donc, trouver l&#8217;hébergeur de confiance.</p>
<p>Nous pouvons diviser le chapitre de l&#8217;hébergement en trois catégories : le mutualisé, le serveur virtuel et le serveur dédié. Chacune de ces catégories peut aussi être associé à une infogérance via un prestataire qui peut être l&#8217;hébergeur ou un tiers de confiance.</p>
<h3>Ce qu&#8217;il faut savoir</h3>
<p>Plusieurs choses sont à connaitre avant de choisir son hébergeur et à vérifier. Tout d&#8217;abord le nombre de site que vous allez pouvoir héberger sur votre machine ainsi que le nombre de sous-domaines. Si vous n&#8217;avez peut être actuellement qu&#8217;un seul site, ce ne sera peut être pas tout le temps le cas. Viennnet ensuite le nombre de base de données et leurs tailles afin de ne pas tout mettre ses œufs dans le même panier. Enfin le trafic mensuel, le nombre de comptes emails (ainsi que la taille des boites mails) ou encore le nombre de compte ftp. N&#8217;hésitez pas à vous faire un tableau comparatif !</p>
<p>Certaines solutions ont aussi besoins de serveur Microsoft (pour de l&#8217;asp/.net ou autre choses M$) mais la plupart du temps, la suite Linux/Apache/Mysql est utilisée.</p>
<h3>Les différentes offres</h3>
<h4>L&#8217;offre mutualisée</h4>
<p>L&#8217;offre mutualisée est la moins chére disponible sur le marché. Cela vient essentiellement du fait qu&#8217;une seule et même machine sert à héberger plusieurs dizaines voir centaines de sites (plutôt des centaines d&#8217;ailleurs). Les performances générales de la machine peuvent donc être plus ou moins fiable même en tenant compte du fait que les hébergeurs les surveillent généralement relativement bien afin d&#8217;éviter un désagrément de ce type à tous leurs clients.</p>
<p><strong>Avantange :</strong> Le prix qui est généralement associé à un package relativement intéressant pour l&#8217;utilisateur aux besoins lambda.<br />
<strong>Inconvénient :</strong> Il faudra cependant se demander si le trafic général (la moyenne de données échangées entre votre site et le visiteur multipliée par le nombre de visiteurs) de la machine ne vas être trop gourmand pour un hébergement mutualisé. Dans ce cas, votre hébergeur pourrait vous demander de passer sur une autre offre (serveur virtuel ou dédié) ou alors couper votre site&#8230;<br />
<strong>Avis :</strong> L&#8217;hébergement mutualisé est largement suffisant dans 90% des projets web, alors profitez-en !</p>
<h4>Le serveur dédié virtuel</h4>
<p>Second palier, le serveur dédié virtuel. Pourquoi virtuel et pourquoi dédié ? Tout simplement car le serveur dédié virtuel est un serveur hébergé sur la même machine que d&#8217;autres clients (tout comme un serveur mutualisé mais avec beaucoup moins de monde). Le prestataire via un système de virtualisation à donc partagé sa machine en en sous-ensemble de machine dont vous êtes l&#8217;un des heureux possesseurs. Vous ne louez donc pas un serveur dédié à proprement parlé mais êtes libre de la même manière.</p>
<p><strong>Avantage :</strong> L&#8217;apparente liberté qu&#8217;offrent ce type d&#8217;hébergement. Elles sont par ailleurs moins chères qu&#8217;un serveur dédié.<br />
<strong>Inconvénient :</strong> Les connaissances techniques, qui dit dédié dit installation/configuration/maintenance et donc un niveau de connaissance technique. Il faudra donc suivant les prestataires penser à se trouver un allié en cas de pépin&#8230;<br />
<strong>Avis :</strong> Un bon intermédiaire même si je préfère pour ma part soit le mutualisé, soit le dédié&#8230; Il y a des fois comme ça&#8230; <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h4>Le serveur dédié</h4>
<p>La rolls de l&#8217;hébergement, le serveur dédié vous permet en toute liberté de faire ce que vous entendez de votre serveur. Il faudra donc regarder du coté des spécifications de la machine, de la bande-passante ou encore du type de connexion. Ensuite, il faudra choisir la système d&#8217;exploitation utilisé sur la machine Ubuntu, Debian, Gentoo&#8230; Ou encore Windows Server ?</p>
<p>D&#8217;autres questions pourront se poser, panel de gestion ou pas ? Et dans ce cas lequel ? Qui va installer cette machine et la maintenir dans le temps (ne serait-ce que pour faire les mises à jours) ? Quelle va être la stratégie de sécurité ?</p>
<p>Vous l&#8217;aurez compris, le serveur dédié est réservé aux personnes ayant de bonnes voir de très bonnes connaissances dans le milieu de l&#8217;administration de serveur. Et comme enfoncer le clou est toujours important, l&#8217;administration de serveur n&#8217;est pas chose facile mais installer un serveur l&#8217;est&#8230; Attention aux touristes du web !</p>
<p><strong>Avantage :</strong> La flexibilité.<br />
<strong>Inconvénients :</strong> Le prix et les connaissances techniques associées à ce type d&#8217;hébergement.<br />
<strong>Avis :</strong> Si vous pouvez le faire, faites-le. On ne regrette malheureusement jamais un serveur dédié, excepté pour les apprentis bricoleurs du web.</p>
<h3>Et le nom de domaine ?</h3>
<p>Chacun des hébergeurs que vous trouverez (en dehors des serveurs dédiés) vous offre la possibilité d&#8217;enregistrer, de transférer ou d&#8217;héberger des noms de domaines. Certains hébergeur vous offrirons mêmes un ou deux noms de domaine en souscrivant chez eux. L&#8217;autre option est d&#8217;acheter vos noms de domaines chez un prestataire tiers afin de ne pas vous retrouver bloqué avec votre hébergeur car vous l&#8217;apprendrez malheureusement pas toujours de la bonne manière, le transfert d&#8217;un nom de domaine d&#8217;une société à une autre est en général un véritable parcours du combattant.</p>
<p>Pour ma part j&#8217;utilise <a href="http://www.gandi.net">gandi</a> pour gérer mes domaines et n&#8217;ai jamais eu de problème. Il faut dire que je n&#8217;ai aussi jamais chercher à transférer de domaine entres plusieurs registrar&#8230;</p>
<h3>Les gros VS les petits</h3>
<p>Derniers point mais toujours aussi important, faut-il plutôt s&#8217;orienter vers les gros du web tels qu&#8217;OVH ou 1&#038;1 ou vers des prestataires plus petits comme PHPnet voir carrément intimiste pour certains ?<br />
Ma réponse sera très simple, tout dépend de ce que vous avez à héberger, avec quel type d&#8217;hébergement et qui peut vous appuyer en cas de problème.</p>
<p>Voici donc ceux que j&#8217;ai pu essayer :</p>
<ul class="notype">
<li><strong>OVH :</strong> J&#8217;ai essayé les offres mutualisées et les serveurs dédiés. Pour ma part le panel d&#8217;administration me laisse un peu perplexe, j&#8217;ai toujours eu beaucoup de mal à m&#8217;y repérer. Reste qu&#8217;OVH en tant que gros du web est une bonne solution. Attendez-vous seulement à n&#8217;être qu&#8217;un client parmi tant d&#8217;autres.<br /><a href="http://www.ovh.com/fr/particulier/index.xml">Le site</a></li>
<li><strong>1&#038;1 :</strong> Autre &laquo;&nbsp;gros&nbsp;&raquo; du web, je n&#8217;ai essayé que la solution mutualisé de 1&#038;1 et n&#8217;ai jamais eu de problèmes particuliers.<br /><a href="http://commander.1and1.fr/xml/order/Home;jsessionid=EEEA058A6A5BEF83642C44CA37218740.TC33b?__reuse=1223298264013">Le site</a></li>
<li><strong>PHPnet :</strong> Mon préféré, malgré un problème rencontré en 2005 qui m&#8217;a donné bien du fil à retordre, PHPnet reste mon hébergeur culte. Tout me plait (peut être à force de l&#8217;utiliser je ne sais plus), les offres tiennent la route, le suivi aussi et particulièrement en cas de pépin.<br /><a href="http://www.phpnet.org/">Le site</a></li>
<li><strong>Celeonet :</strong> Il faut bien dire du mal de quelqu&#8217;un&#8230; J&#8217;ai utilisé un hébergement en mutualisé qui ne m&#8217;a jamais donné satisfaction, même dans l&#8217;administration d&#8217;un blog wordpress fraichement installé.<br /><a href="http://www.celeonet.fr/">Le site</a></li>
<li><strong>Dedibox :</strong> J&#8217;ai comme beaucoup d&#8217;autres pu essayer les dédibox lors du lancement de l&#8217;offre. Pas vraiment de déception puisque tout était géré par mes soins. Ma box à cependant connu quelques problèmes matériels indépendant de ma volonté. Après quelques déboires, je me suis surtout aperçu que gérer un dédié me prenait beaucoup de temps et que je n&#8217;en avais pas forcément le besoin. Un très bon apprentissage pour un cout faible comparé aux autres offres dédiés de l&#8217;époque.<br /><a href="http://www.dedibox.fr/">Le site</a></li>
<li><strong>Etigris :</strong> J&#8217;utilise ce prestataire belge pour héberger certains sites en mutualisé. Si le prix est supérieur à la moyenne, le suivi client est particulièrement efficace et même à la hauteur d&#8217;un serveur dédié. On a donc quelque chose idéal pour une personne désirant un serveur mutualisé avec des exigences de réactivités importantes. Sur ce point, rien à redire.<br /><a href="http://www.etigris.com/">Le site</a></li>
<li><strong>Elginux :</strong> J&#8217;utilise cet hébergeur pour un site seulement, nous avions besoin d&#8217;un serveur efficace, infogéré avec une réactivité très importante. Après consultations des différentes offres et comparatif des tarifs, elginux est sorti du lot.<br /><a href="http://elginux.com/">Le site</a></li>
</ul>
<h3>Conclusion</h3>
<p>Je pense avoir fait le tour de toutes les choses à savoir avant de créer un site web. Vous avez donc suffisamment de cartes en main pour savoir quoi faire et ou aller. Ce blog va donc passer dans une phase plus technique et graphique puisque nous allons voir des barbaries de développeurs, webdesigners ou encore intégrateurs.</p>
<p>Place maintenant au PHP, xHTML, CSS, Flash et ActionScript, webdesign le tout sur une base de Wordpress. Et oui.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-3-le-choix-de-lhebergeur/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>La création d’un site internet de A à Z &#8211; Etape #2.3 : Showcase!</title>
		<link>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-23-showcase/</link>
		<comments>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-23-showcase/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 13:50:38 +0000</pubDate>
		<dc:creator>pocky</dc:creator>
				<category><![CDATA[inspiration]]></category>
		<category><![CDATA[www]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://blog.pockyworld.com/?p=806</guid>
		<description><![CDATA[Afin d&#8217;en finir avec l&#8217;étape numéro 2, une petite sélection de sites utilisant les CMS cités dans l&#8217;article précédent.
Joomla
Know your rights

Porsche Brasil

SPIP
Supercasino

Evian masters 2008

Drupal
Spread Firefox

Ubuntu

OsCommerce
Waliboo

Pimkie

Prestashop
Mageekstore et Laurent qui fête son anniversaire aujourd&#8217;hui 

Wordpress
Jeux de maux

Lukasz Adamczak

Dotclear
Fubiz

Movable
SimpleBits

]]></description>
			<content:encoded><![CDATA[<p>Afin d&#8217;en finir avec l&#8217;étape numéro 2, une petite sélection de sites utilisant les CMS cités dans l&#8217;<a href="http://blog.pockyworld.com/la-creation-d%E2%80%99un-site-internet-de-a-a-z-etape-22-mais-euh-cest-quoi-ces-trucs-wordpressjoomla-ou-encore-oscommerce/">article précédent</a>.</p>
<h4>Joomla</h4>
<p><strong>Know your rights</strong><br />
<a href="http://www.knowyourrights2008.org/fr/"><img src="http://blog.pockyworld.com/wp-content/uploads/joomla-know-your-rights-2008.jpg" alt="" title="joomla-know-your-rights-2008" class="alignnone size-full wp-image-810" /></a></p>
<p><strong>Porsche Brasil</strong><br />
<a href="http://porsche.com.br/"><img src="http://blog.pockyworld.com/wp-content/uploads/joomla-porsche-brasil.jpg" alt="" title="joomla-porsche-brasil" class="alignnone size-full wp-image-811" /></a></p>
<h4>SPIP</h4>
<p><strong>Supercasino</strong><br />
<a href="http://www.supercasino.fr"><img src="http://blog.pockyworld.com/wp-content/uploads/joomla-supercasino.jpg" alt="" title="joomla-supercasino" class="alignnone size-full wp-image-812" /></a></p>
<p><strong>Evian masters 2008</strong><br />
<a href="http://www.evianmasters.com"><img src="http://blog.pockyworld.com/wp-content/uploads/spip-evian-masters-2008.jpg" alt="" title="spip-evian-masters-2008" class="alignnone size-full wp-image-818" /></a></p>
<h4>Drupal</h4>
<p><strong>Spread Firefox</strong><br />
<a href="http://www.spreadfirefox.com"><img src="http://blog.pockyworld.com/wp-content/uploads/drupal-spread-firefox.jpg" alt="" title="drupal-spread-firefox" class="alignnone size-full wp-image-808" /></a></p>
<p><strong>Ubuntu</strong><br />
<a href="http://www.ubuntu.com"><img src="http://blog.pockyworld.com/wp-content/uploads/drupal-ubuntu.jpg" alt="" title="drupal-ubuntu" class="alignnone size-medium wp-image-809" /></a></p>
<h4>OsCommerce</h4>
<p><strong>Waliboo</strong><br />
<a href="http://boutique.waliboo.com"><img src="http://blog.pockyworld.com/wp-content/uploads/oscommerce-boutique-waliboo.jpg" alt="" title="oscommerce-boutique-waliboo" class="alignnone size-full wp-image-814" /></a></p>
<p><strong>Pimkie</strong><br />
<a href="http://www.pinmkie.com"><img src="http://blog.pockyworld.com/wp-content/uploads/oscommerce-pimkie-france.jpg" alt="" title="oscommerce-pimkie-france"  class="alignnone size-medium wp-image-815" /></a></p>
<h4>Prestashop</h4>
<p><strong>Mageekstore</strong> et Laurent qui fête son anniversaire aujourd&#8217;hui <img src='http://blog.pockyworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<a href="http://www.mageekstore.com"><img src="http://blog.pockyworld.com/wp-content/uploads/prestashop-mageekstore.jpg" alt="" title="prestashop-mageekstore" class="alignnone size-full wp-image-817" /></a></p>
<h4>Wordpress</h4>
<p><strong>Jeux de maux</strong><br />
<a href="http://www.jeuxdemaux.com"><img src="http://blog.pockyworld.com/wp-content/uploads/wordpress-jeux-de-maux.jpg" alt="" title="wordpress-jeux-de-maux" class="alignnone size-full wp-image-820" /></a></p>
<p><strong>Lukasz Adamczak</strong><br />
<a href="http://czak.pl"><img src="http://blog.pockyworld.com/wp-content/uploads/wordpress-adamczak.jpg" alt="" title="wordpress-adamczak" class="alignnone size-full wp-image-819" /></a></p>
<h4>Dotclear</h4>
<p><strong>Fubiz</strong><br />
<a href="http://www.fubiz.net"><img src="http://blog.pockyworld.com/wp-content/uploads/dotclear-fubiz.jpg" alt="" title="dotclear-fubiz" class="alignnone size-full wp-image-807" /></a></p>
<h4>Movable</h4>
<p><strong>SimpleBits</strong><br />
<a href="http://www.simplebits.com"><img src="http://blog.pockyworld.com/wp-content/uploads/movable-simplebits.jpg" alt="" title="movable-simplebits" class="alignnone size-medium wp-image-813" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pockyworld.com/la-creation-d%e2%80%99un-site-internet-de-a-a-z-etape-23-showcase/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
