Centrer une Div

Résolu/Fermé
x_Purre Messages postés 16 Date d'inscription jeudi 4 août 2011 Statut Membre Dernière intervention 25 janvier 2012 - 31 déc. 2011 à 19:52
x_Purre Messages postés 16 Date d'inscription jeudi 4 août 2011 Statut Membre Dernière intervention 25 janvier 2012 - 1 janv. 2012 à 22:12
Bonjour,

je dévloppe présentement un service d'hébergement d'image. Mais le problème c'est que je ne sais pas comment centrer a div. Comme si je le centre manuellement, cela ne sera pas pareille sur un autre résolution. Voilà mon script :

<HTML>
<HEAD>
<TITLE>Fotoz - Hébergement Gratuit !</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<body background="back2.png">
<div id="Layer2" style="position:absolute; left:336px; top:32px; width:1013px; height:126px; z-index:2">

<script type="text/javascript"><!--
google_ad_client = "ca-pub-9909992342275031";
/* Fotoz 2 */
google_ad_slot = "7887205153";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<center><script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (Untitled-4) -->
  <div id="Layer1" style="position:absolute; left:345px; top:327px; width:983px; height:342px; z-index:1;" align="center"> 
    <?php
$poids_max = 512000; // Poids max de l'image en octets (1Ko = 1024 octets)
$repertoire = 'uploads/'; // Repertoire d'upload
if (isset($_FILES['fichier']))

{

// On vérifit le type du fichier
if ($_FILES['fichier']['type'] != 'image/png' && $_FILES['fichier']['type'] != 'image/jpeg' && $_FILES['fichier']['type'] != 'image/jpg' && $_FILES['fichier']['type'] != 'image/gif' && $_FILES['fichier']['type'] != 'image/bmp' && $_FILES['fichier']['type'] != 'image/jpg' && $_FILES['fichier']['type'] != 'image/png' && $_FILES['fichier']['type'] != 'image/ico')
{
$erreur = 'Le fichier doit être au format *.jpeg, *.bmp, *.jpg, *.png, *.ico *.gif ou *.png .';
}

// On vérifit le poids de l'image
elseif ($_FILES['fichier']['size'] > $poids_max)
{
$erreur = 'L\'image doit être inférieur à ' . $poids_max/1024 . 'Ko.';
}

// On vérifit si le répertoire d'upload existe
elseif (!file_exists($repertoire))
{
$erreur = 'Erreur, le dossier d\'upload n\'existe pas.';
}

// Si il y a une erreur on l'affiche sinon on peut uploader
if(isset($erreur))
{
echo '' . $erreur . '<br><a href="javascript:history.back(1)">Retour</a>';
}
else
{

// On définit l'extention du fichier puis on le nomme par le timestamp actuel
if ($_FILES['fichier']['type'] == 'image/jpeg') { $extention = '.jpeg'; }
if ($_FILES['fichier']['type'] == 'image/jpeg') { $extention = '.jpg'; }
if ($_FILES['fichier']['type'] == 'image/png') { $extention = '.png'; }
if ($_FILES['fichier']['type'] == 'image/gif') { $extention = '.gif'; }
$nom_fichier = time().$extention;

// On upload le fichier sur le serveur.

if (move_uploaded_file($_FILES['fichier']['tmp_name'], $repertoire.$nom_fichier))
{
$url = 'http://fotoz.olympe-network.com//'.$repertoire.''.$nom_fichier.'';
echo 'Votre image à été uploadée sur les serveurs de Fotoz avec succes!<br>Voici le lien: <br />
   <br/>
   <img src="uploads/'.$nom_fichier.'" width="300px" height="120px"border="2px" />
   <br/>
<b>&#8226;Pour les Forums</b> =  <input type="text" value="[img]' . $url . '/img" /><br />
<br />
<b>&#8226;Lien Forum</b> = <input type="text" value="[url]' . $url . '/url" /><br />
<br />
<b>&#8226Lien de l\'image </b> <input type="text" value="'.$url.'" />
<br><a href="javascript:history.back(1)">Héberger d\'autre images sur Fotoz !</a>

<TABLE WIDTH=1016 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD COLSPAN=3>
			<IMG SRC="images/sitehtml2_01.gif" WIDTH=1016 HEIGHT=127 ALT=""></TD>
	</TR>
	<TR>
		<TD COLSPAN=3>
			<IMG SRC="images/sitehtml2_02.gif" WIDTH=1016 HEIGHT=138 ALT=""></TD>
	</TR>
	<TR>
		<TD COLSPAN=3>
			<IMG SRC="images/sitehtml2_03.gif" WIDTH=1016 HEIGHT=371 ALT=""></TD>
	</TR>
	<TR>
		<TD ROWSPAN=2>
			<IMG SRC="images/sitehtml2_04.gif" WIDTH=11 HEIGHT=214 ALT=""></TD>
		<TD>
			<IMG SRC="images/sitehtml2_05.gif" WIDTH=995 HEIGHT=62 ALT=""></TD>
		<TD ROWSPAN=2>
			<IMG SRC="images/sitehtml2_06.gif" WIDTH=10 HEIGHT=214 ALT=""></TD>
	</TR>
	<TR>
		<TD>
			<IMG SRC="images/sitehtml2_07.gif" WIDTH=995 HEIGHT=152 ALT=""></TD>
	</TR>
</TABLE>

';
}
else
{
echo 'L\'image n\'a pas pu être uploadée sur le serveur.';
}

}

}
else
{
?>
   <center> <p>Bienvenue sur Fotoz ! L'hébergeur N.1 au Canada ! Cliquez sur parcourire, 
      ensuite choissisez votre image. Faîtes envoyer et le tour est jouer 
      !</p>
    <p>Si vous tenez à Fotoz, merci bien de faire un don pour le nom de 
      domaine et le serveur. Bonne journer !</p>
    <p>Nous acceptons seulement les types de fichiers suivant: *.jpeg, *.bmp, 
      *.jpg, *.png, *.ico *.gif ou *.png. </p>
    <p>&nbsp;</p>
    </center>
	
    <form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $poids_max; ?>">
<input type="file" name="fichier">
<input type="submit" value="Envoyer">
</form>

   </div>
<TABLE WIDTH=1016 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD COLSPAN=3>
			<IMG SRC="images/sitehtml2_01.gif" WIDTH=1016 HEIGHT=127 ALT=""></TD>
	</TR>
	<TR>
		<TD COLSPAN=3>
			<IMG SRC="images/sitehtml2_02.gif" WIDTH=1016 HEIGHT=138 ALT=""></TD>
	</TR>
	<TR>
		<TD COLSPAN=3>
			<IMG SRC="images/sitehtml2_03.gif" WIDTH=1016 HEIGHT=371 ALT=""></TD>
	</TR>
	<TR>
		<TD ROWSPAN=2>
			<IMG SRC="images/sitehtml2_04.gif" WIDTH=11 HEIGHT=214 ALT=""></TD>
		<TD>
			<IMG SRC="images/sitehtml2_05.gif" WIDTH=995 HEIGHT=62 ALT=""></TD>
		<TD ROWSPAN=2>
			<IMG SRC="images/sitehtml2_06.gif" WIDTH=10 HEIGHT=214 ALT=""></TD>
	</TR>
	<TR>
		<TD>
			<IMG SRC="images/sitehtml2_07.gif" WIDTH=995 HEIGHT=152 ALT=""></TD>
	</TR>
</TABLE>
</center>

<!-- End ImageReady Slices -->
<?php
}
?>
</BODY>
</HTML>



4 réponses

Kaotix96 Messages postés 108 Date d'inscription lundi 5 septembre 2011 Statut Membre Dernière intervention 5 juillet 2013 12
1 janv. 2012 à 12:34
Essais
margin-left: auto;
margin-right: auto;
0
x_Purre Messages postés 16 Date d'inscription jeudi 4 août 2011 Statut Membre Dernière intervention 25 janvier 2012
1 janv. 2012 à 21:26
Et je mes sa ou exactement ?
0
Kaotix96 Messages postés 108 Date d'inscription lundi 5 septembre 2011 Statut Membre Dernière intervention 5 juillet 2013 12
1 janv. 2012 à 21:31
dans le css de la div que tu veux center
0
x_Purre Messages postés 16 Date d'inscription jeudi 4 août 2011 Statut Membre Dernière intervention 25 janvier 2012
1 janv. 2012 à 22:12
J'ai pas de css dans mon code.
0