Jump to content


Photo

Rodapé - Problemas


  • Faça o login para participar
2 replies to this topic

#1 MaRaCa

MaRaCa

    Normal

  • Usuários
  • 118 posts
  • Sexo:Não informado

Posted 03/08/2006, 11:47

Olá pessoal!

Estou com problemas para deixar o rodapé sempre fixo na parte inferior do navegador. Já fui AListApart peguei uma solução deles lá que funciona certinho, menos no IE ;/

Se alguém souber um solução pra isso, fico MUITOO grato!

Segue o código para analise

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}

body {
margin: 0;
padding: 0;
text-align:center;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
#content {
width: 780px;
margin: 0 auto;
text-align: left;
background: #ccc;
}

#footer { 
position: absolute;  /* Needed for Safari */
padding: 10px;
height: 12px;
bottom: 0;
background-color: #aa3939;
width: 98%;
}
</style>
<script type="text/javascript">
		<!--
		function getWindowHeight() {
			var windowHeight = 0;
			if (typeof(window.innerHeight) == 'number') {
				windowHeight = window.innerHeight;
			}
			else {
				if (document.documentElement && document.documentElement.clientHeight) {
					windowHeight = document.documentElement.clientHeight;
				}
				else {
					if (document.body && document.body.clientHeight) {
						windowHeight = document.body.clientHeight;
					}
				}
			}
			return windowHeight;
		}
		function setFooter() {
			if (document.getElementById) {
				var windowHeight = getWindowHeight();
				if (windowHeight > 0) {
					var contentHeight = document.getElementById('content').offsetHeight;
					var footerElement = document.getElementById('footer');
					var footerHeight  = footerElement.offsetHeight;
					if (windowHeight - (contentHeight + footerHeight) >= 0) {
						footerElement.style.position = 'relative';
						footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
					}
					else {
						footerElement.style.position = 'static';
					}
				}
			}
		}
		window.onload = function() {
			setFooter();
		}
		window.onresize = function() {
			setFooter();
		}
		//-->
		</script>
</head>

<body>
<div id="content">
<p>teste teste teste</p>
<p>teste teste teste</p>

<p>teste teste teste</p>
<p>teste teste teste</p>
<p>teste teste teste</p>
<p>teste teste teste</p>
</div>

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

</body>
</html>

Edição feita por: MaRaCa, 03/08/2006, 11:50.


#2 Andreia Regina

Andreia Regina

    Veterano

  • Conselheiros
  • 1347 posts
  • Sexo:Feminino
  • Localidade:PR
  • Interesses:PHP; MySQL; Javascript; CSS; tudo ligado ao desenvolvimento web.

Posted 03/08/2006, 13:23

Adicione na div footer:
	clear: both;

Fórum WMO - Conselheira - Na equipe desde 31/01/2006.
Links importantes: Regras de conduta - Busca do fórum


#3 Publicitario

Publicitario

    Normal

  • Usuários
  • 96 posts
  • Sexo:Não informado

Posted 03/08/2006, 14:09

cara eu tb tava quebrando a cabeça com posição do rodapé .... substitui no meu código o position:absolute por relative e deu tudo certo tenta ai ...
Solucionna - IT Services
Sites, impressos, sistemas online e consultoria em TI
www.solucionna.net
Envie-nos seu currículo e portfólio: rh@solucionna.net

Nortear Investimentos
Investimentos em fundos, açõe, imóveis e câmbio
www.nortearinvestimentos.com




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq