Centrer barre de recherche

Résolu
Bonjour,
Je suis en train de créer mon site et je voudrais créer une page ou il n'y a qu'une image de fond et un champ de recherche google. Je voudrais que le champ de recherche google soit centré. Comment dois-je faire ? Pouvez-vous m'aidez ?
Voici ce que j'ai pour l'instant :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Mon Site Web.</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<!-- Champ de recherche Google -->
<center>
<FORM method=GET action="https://www.google.fr/webhp?gws_rd=ssl">
<TABLE bgcolor="#FFFFFF"><tr><td>
<A HREF="https://www.google.fr/?gws_rd=ssl">
<IMG SRC="http://www.google.com/logos/Logo_40wht.gif" border="0"
ALT="Google" align="absmiddle"></A>
<INPUT TYPE=text name=q size=31 maxlength=255 value="">
<INPUT TYPE=hidden name=hl value=fr>
<INPUT type=submit name=btnG VALUE="Recherche Google">
</td></tr></TABLE>
</FORM>
</center>
<!-- Google -->
</body>
</html>

Merci d'avance.
Web.

3 réponses

  1. Contributeur
    Salut,

    Voilà le code :

    <div align="center"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
    <head>
    <title>Mon Site Web.</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <!-- Champ de recherche Google -->
    <center>
    <FORM method=GET action="https://www.google.fr/webhp?gws_rd=ssl">
    <TABLE bgcolor="#FFFFFF"><tr><td>
    <A HREF="https://www.google.fr/?gws_rd=ssl">
    <IMG SRC="http://www.google.com/logos/Logo_40wht.gif" border="0"
    ALT="Google" align="absmiddle"></A>
    <INPUT TYPE=text name=q size=31 maxlength=255 value="">
    <INPUT TYPE=hidden name=hl value=fr>
    <INPUT type=submit name=btnG VALUE="Recherche Google">
    </td></tr></TABLE>
    </FORM>
    </center>
    <!-- Google -->
    </body>
    </html></div>


    A+ =)
    1. Un grand merci à toi LordMacDragus pour cette réponse rapide !
      Problème résolu !
      @+ sur Commentcamarche.net
    2. Pardonne moi pour le dérangement j'aurais du préciser que quand je disais centrer c'est pour que le champ de recherche soit au milieu de la page...
      :S
    3. Contributeur
      Alors le code est celui-ci :

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > 
      <head> 
      <title>Mon Site Web.</title> 
      <meta http-equiv="Content-Type" content="text/html; 
      charset=iso-8859-1" /> 
      <!-- Champ de recherche Google --> 
      <div align="center"><center> 
      <FORM method=GET action="https://www.google.fr/webhp?gws_rd=ssl"> 
      <TABLE bgcolor="#FFFFFF"><tr><td> 
      <A HREF="https://www.google.fr/?gws_rd=ssl"> 
      <IMG SRC="http://www.google.com/logos/Logo_40wht.gif" border="0" 
      ALT="Google" align="absmiddle"></A> 
      <INPUT TYPE=text name=q size=31 maxlength=255 value=""> 
      <INPUT TYPE=hidden name=hl value=fr> 
      <INPUT type=submit name=btnG VALUE="Recherche Google"> 
      </td></tr></TABLE> 
      </FORM> 
      </center></div> 
      <!-- Google --> 
      </body> 
      </html> 


      A+ =)
    4. J'ai essayé mais cela ne marche toujours pas, le champ de recherche est centré en haut de la page et pas au centre...
      :-|
    5. Contributeur
      Essaye ceci :

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > 
      <head> 
      <title>Mon Site Web.</title> 
      <meta http-equiv="Content-Type" content="text/html; 
      charset=iso-8859-1" /> 
      <!-- Champ de recherche Google --> 
      <div align="center"><div style="display:table-cell; vertical-align:middle"><center> 
      <FORM method=GET action="https://www.google.fr/webhp?gws_rd=ssl"> 
      <TABLE bgcolor="#FFFFFF"><tr><td> 
      <A HREF="https://www.google.fr/?gws_rd=ssl"> 
      <IMG SRC="http://www.google.com/logos/Logo_40wht.gif" border="0" 
      ALT="Google" align="absmiddle"></A> 
      <INPUT TYPE=text name=q size=31 maxlength=255 value=""> 
      <INPUT TYPE=hidden name=hl value=fr> 
      <INPUT type=submit name=btnG VALUE="Recherche Google"> 
      </td></tr></TABLE> 
      </FORM> 
      </center></div></div> 
      <!-- Google --> 
      </body> 
      </html> 
  2. Edit: Pardon j'ai mal lu, centrer verticalement et horizontalement, tu fais
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
    <head>
    <title>Mon Site Web.</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <!-- Champ de recherche Google -->
    
    <FORM method=GET action="https://www.google.fr/webhp?gws_rd=ssl" style="margin:auto;">
    <TABLE bgcolor="#FFFFFF"><tr><td>
    <A HREF="https://www.google.fr/?gws_rd=ssl">
    <IMG SRC="http://www.google.com/logos/Logo_40wht.gif" border="0"
    ALT="Google" align="absmiddle"></A>
    <INPUT TYPE=text name=q size=31 maxlength=255 value="">
    <INPUT TYPE=hidden name=hl value=fr>
    <INPUT type=submit name=btnG VALUE="Recherche Google">
    </td></tr></TABLE>
    </FORM>
    
    <!-- Google -->
    </body>
    </html> 
    
    1. Non, ça met google dans le bord supérieur droit...
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > 
    <head> 
    <title>Mon site web</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
    <style type="text/css">       
    div {  
    width:500px; 
    height:50px; 
    position:absolute; 
    top:50%; 
    left:50%; 
    margin-left:-250px; 
    margin-top:-25px; 
    } 
    </style> 
    </head> 
    <body>  
    <div> 
    <form method="GET" action="https://www.google.fr/webhp?gws_rd=ssl">  
    <a href="https://www.google.fr/?gws_rd=ssl">  
    <img src="http://www.google.com/logos/Logo_40wht.gif" alt="Google" /></a>  
    <input type="text" name="q" size="31" maxlength="255" value="" />  
    <input type="hidden" name="hl" value="fr" />  
    <input type="submit" name="btnG" value="Recherche Google" />  
    </form>   
    </div> 
    </body> 
    </html> 


    Petite précision : le doctype utilisé est du xhtml 1.0 strict => les balises doivent être écrites en minuscules, elle doivent toutes être fermées, les attributs doivent être entre guillemets et balises doivent être correctement imbriquées.
    Sinon, prendre le doctype de html 4.01 transitionel.
    <blockquote cite="Shakespeare">To be or not to be ; That is the question...</blockquote>
    1. Wouhou ! Ça marche !!!
      Un grand merci à toi notobe.
      @+
    2. pas d'quoi :)