Centrar con CSS una web : en general cualquier elemento de bloque

Para centrar las páginas de nuestra web, podemos hacerlo así de sencillo utilizando DIV y dándole estilo con CSS:


  body {   text-align:center; }
  #principal{   width:70%;   margin:0 auto;   text-align:left;}

Y el código HTML:


  <body>
    <div id="principal">
      Todo lo que metas aquí queda centrado
    </div>
</body>

NOTA: La parte de CSS que afecta al BODY, y la propiedad text-align:left paraa el DIV, sólo son necesarias para que funcione en IE con versión inferior a la 6.

Referencia
Juque : Centrando Elementos de Bloque

One Response to “Centrar con CSS una web : en general cualquier elemento de bloque”

  1. 2012 Fashion ideas p…

    Your first appearance, he said to me, is the gauge by which you will be measured; try to manage that you may go beyond yourself in after times, but beware of ever doing less….

Leave a Response

You must be logged in to post a comment.