Noticias Weblogs Foros Wiki Código

RecorteX

399 usuarios y 231 recortes de código
Usuario

Contraseña
Crear cuenta
8 Ajax asp csharp css fechas Flash html imagenes java javascript linux mysql oracle php sql SQLServer vbnet xhtml xml
Top Usuarios
fjmp76 (35)
albin (31)
josuebasurto (29)
juanjo (29)
pedrocaro (9)
stanz (8)
AndiXTRM (7)
Joserra (7)
miiglesi (6)
aplyca (5)
Top Etiquetas
php (38)
vbnet (27)
javascript (26)
html (25)
java (22)
sql (17)
csharp (16)
xml (13)
mysql (13)
css (10)
Flash (7)
imagenes (7)
xhtml (7)
linux (6)
asp (6)
fechas (6)
oracle (5)
SQLServer (5)
8 (4)
Ajax (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 - Información legal y técnica