Page 1 sur 1

Footer toujours en bas sauf... Corrigez mon code !

Publié : 29 janv. 2007, 17:20
par guilhem_mdg
Bonjour à tous,
Je bloque sur la fin toute proche d'un développement (enfin je pense).
Quelq'un peut-il m'aider ?
Je cherche à ce que le footer soit toujours en bas de l'écran sauf si le contenu du menu (partie gauche) ou de la page (partie droite) est trop longue et dépasse de l'écran.
J'ai presque réussi mais j'ai un bug d'affichage du fond.
Ca doit être compatible IE6/Mozilla.
Voici mon code :

Code : Tout sélectionner

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>3 col layout with equalising columns and footer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
/* Divers */
html,
body,
#container {
	height:100%;
}
body{
	padding:0;
	margin:0;
}
#container {
	width:800px;
	margin:0 auto 0 auto;
	position:relative;
	background:pink;
	color: #000000;
}
/* Header */
#header{
	position:absolute;
	top:0;
	left:0;
	width:100%;
	overflow:hidden;
	height:70px;
	background:#FF0000;
	color: #000000;
}
#clearheader{
	height:70px;
}
/* Centre */
#centre{
	min-height:100%;
	margin-left:160px;
	background:#F8E7EC;
	margin-bottom:-40px;
	color:#000000;
}

/* Menu */
#menu {
	position:relative;
	width:157px;
	margin-left:-158px;
	margin-top:70px;
	float:left;
}
/* Footer */
#footer {
	width:100%;
	clear:both;
	height:40px;
	background-color: #FF8080;
	position:relative;
}
#clearfooter{
	clear:both;
}
</style>

<!--[if IE]>
<style>
* html #centre{
	height:100%;
	margin-left:157px;
}
* html #menu {
	margin-right:-3px;
}
* html #page {
	height:1%;
	margin-bottom:12px;
}
</style>
<![endif]-->

</head>
<body><div id="container">
	<div id="header">Header</div>
	<div id="centre"> 
		<div id="menu"> 
			<p>Left Content goes here : Left Content goes here : Left Content goes here 
			: Left Content goes here : Left Content goes here : Left Content goes here 
			: Left Content goes here : Left Content goes here : Left Content goes here 
			: Left Content goes here : </p>
		</div>
		<div id="clearheader"></div>
		
		<div id="page">
			<p>Centre Content goes here</p>
			<p>2 column layout - any column can be the longest. Footer will stay at bottom 
			of window unless content is greater then it stays at bottom of document.</p>
			<p>Only tested on PC (IE5, 5.5 , 6, Mozilla 1.2 , Firebird 0.6.1, Opera7,Netscape 
			6.2). Opera 6 doesn't like the footer but it's usable.I expect mac and other 
			browsers will fall over. (<strong>*Update*</strong> Mac Firebird and Mac 
			Netscape 6 & 7 (OS9) look perfect in all cases. Mac IE 5.1.7 & IE5.2.3 
			and Safari1.1.1 don't like the footer and render it at bottom of the longest 
			column. However the columns works fine ane the effect is still usable. Thanks 
			to a number of people for checking this out for me as I don't have a mac 
			to test on.)</p>
			<p>Centre Content goes here</p>
			<p>2 column layout - any column can be the longest. Footer will stay at bottom 
			of window unless content is greater then it stays at bottom of document.</p>
			<p>Only tested on PC (IE5, 5.5 , 6, Mozilla 1.2 , Firebird 0.6.1, Opera7,Netscape 
			6.2). Opera 6 doesn't like the footer but it's usable.I expect mac and other 
			browsers will fall over. (<strong>*Update*</strong> Mac Firebird and Mac 
			Netscape 6 & 7 (OS9) look perfect in all cases. Mac IE 5.1.7 & IE5.2.3 
			and Safari1.1.1 don't like the footer and render it at bottom of the longest 
			column. However the columns works fine ane the effect is still usable. Thanks 
			to a number of people for checking this out for me as I don't have a mac 
			to test on.)</p>
			<p>Centre Content goes here</p>
			<p>2 column layout - any column can be the longest. Footer will stay at bottom 
			of window unless content is greater then it stays at bottom of document.</p>
			<p>Only tested on PC (IE5, 5.5 , 6, Mozilla 1.2 , Firebird 0.6.1, Opera7,Netscape 
			6.2). Opera 6 doesn't like the footer but it's usable.I expect mac and other 
			browsers will fall over. (<strong>*Update*</strong> Mac Firebird and Mac 
			Netscape 6 & 7 (OS9) look perfect in all cases. Mac IE 5.1.7 & IE5.2.3 
			and Safari1.1.1 don't like the footer and render it at bottom of the longest 
			column. However the columns works fine ane the effect is still usable. Thanks 
			to a number of people for checking this out for me as I don't have a mac 
			to test on.)</p>
			<p>Centre Content goes here</p>
			<p>2 column layout - any column can be the longest. Footer will stay at bottom 
			of window unless content is greater then it stays at bottom of document.</p>
			<p>Only tested on PC (IE5, 5.5 , 6, Mozilla 1.2 , Firebird 0.6.1, Opera7,Netscape 
			6.2). Opera 6 doesn't like the footer but it's usable.I expect mac and other 
			browsers will fall over. (<strong>*Update*</strong> Mac Firebird and Mac 
			Netscape 6 & 7 (OS9) look perfect in all cases. Mac IE 5.1.7 & IE5.2.3 
			and Safari1.1.1 don't like the footer and render it at bottom of the longest 
			column. However the columns works fine ane the effect is still usable. Thanks 
			to a number of people for checking this out for me as I don't have a mac 
			to test on.)</p>
			

		</div>
		<div id="clearfooter"></div>
	</div>

	<div id="footer">Footer	</div>

</div></body>
</html>
Merci à tous !!

Message envoyé avec : Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

Publié : 29 janv. 2007, 18:10
par myahoo
Bizarre, pour du XHTML 1.0 il n'y a aucune erreur :roll:

Message envoyé avec : Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

Re: Footer toujours en bas sauf... Corrigez mon code !

Publié : 30 janv. 2007, 08:50
par calimo
guilhem_mdg a écrit :Bonjour à tous,
Je bloque sur la fin toute proche d'un développement (enfin je pense).
Quelq'un peut-il m'aider ?
Je cherche à ce que le footer soit toujours en bas de l'écran sauf si le contenu du menu (partie gauche) ou de la page (partie droite) est trop longue et dépasse de l'écran.
J'ai presque réussi mais j'ai un bug d'affichage du fond.
Tu peux préciser ? Où est-ce qu'il y a un fond qui ne s'affiche pas ? Ça me semble fonctionner pas trop mal, non ?



Message envoyé avec : Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1

Publié : 30 janv. 2007, 09:10
par guilhem_mdg
Le fond du menu ne s'affiche pas si tu scrolles plus bas mais peut-être ton écran est très grand et il faut que tu rajoutes du texte à droite pour avoir à scroller... :lol:

Message envoyé avec : Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

Publié : 30 janv. 2007, 10:11
par Asumbaa
Salut,

C'est ton "height: 100%;" sur #container qui fait ça. IE pense que c'est 100% de l'écran donc il s'arrête dès qu'il est caché sous le scroll :lol:

En l'enlevant tout va bien pour la page que tu as donnée, faut voir ce que ça fait avec un long menu.

Message envoyé avec : Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3

Publié : 30 janv. 2007, 10:15
par guilhem_mdg
Asumbaa... Oui ca marche si je l'enlève mais si j'enleve le contenu de ma page (pour ne plus scoller) alors le bug d'affichage réapparaît !

Message envoyé avec : Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

Publié : 30 janv. 2007, 10:44
par Asumbaa
Salut,
guilhem_mdg a écrit :Asumbaa... Oui ca marche si je l'enlève mais si j'enleve le contenu de ma page (pour ne plus scoller) alors le bug d'affichage réapparaît !
Ahhh oui en effet, le footer n'est plus en bas dans ce cas.

C'est bizarre avec WebDeveloper, sous ton menu (dans la zone blanche que tu voudrais éviter), c'est comme s'il n'y avait plus de body.

As-tu décortiqué le tuto Alsacreations sur le sujet ?

Message envoyé avec : Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3

Publié : 30 janv. 2007, 11:28
par guilhem_mdg
Oui... :(

Message envoyé avec : Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

Publié : 30 janv. 2007, 14:04
par calimo
http://www.w3.org/TR/css3-layout/

Bon, c'est pour dans pas avant 10 ans, mais sincèrement je pense que tu en demandes trop à CSS.
(cela dit cet effet est quand-même bizarre, ça va bien sur des contenus petits ou moyens... :roll: )

Message envoyé avec : Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1