Noticias Weblogs Foros Wiki Código

RecorteX

326 usuarios y 203 recortes de código
Usuario

Contraseña
Crear cuenta
asp csharp css fechas fichero Flash html imagenes java javascript linux mysql oracle php ruby sql SQLServer vbnet xhtml xml
Top Usuarios
albin (29)
josuebasurto (28)
fjmp76 (27)
juanjo (25)
pedrocaro (9)
AndiXTRM (7)
Joserra (7)
miiglesi (6)
aplyca (5)
moisesmarquez (5)
Top Etiquetas
php (38)
html (24)
javascript (20)
vbnet (20)
java (19)
sql (15)
mysql (13)
csharp (12)
xml (10)
css (8)
Flash (7)
xhtml (7)
imagenes (7)
asp (6)
linux (6)
fechas (6)
SQLServer (5)
oracle (5)
fichero (4)
ruby (4)

Centrar un DIV con HTML+CSS para IE Y Mozilla Firefox

Para centrar de forma estandar en IE y Mozilla con DIVS y CSS

Solo tienen que crear un DIV con ID que quieran yo por ejemplo hice esto:
 
<!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>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
 
<body>
<div id="main">Content for  id "centrar" Goes Here</div>
</body>
</html>
 
Y el CSS que usaremos sera este:

body {
	text-align: center;
}
#main {
	width: 780px;
	text-align: left;
	margin:0 auto;
	padding: 0px;
	text-align:left;
}
Y listo a partir de ello pueden empezar a crear sus locuras con HTML + CSS
Comentario de albin:
A mí me gusta más
body {
}
#main {
position: relative;
width : 780px;
margin : 0px auto;
padding: 0px;
}
porque el código no se desdice (primero un align, y luego otro).
Identifícate para dejar un comentario.
info@recortex.com - Proyecto: Juanjo Navarro, 2006 - Diseño: Albin