Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/12/2011, 14:06
Avatar de cristian_cena
cristian_cena
Colaborador
 
Fecha de Ingreso: junio-2009
Mensajes: 2.244
Antigüedad: 14 años, 10 meses
Puntos: 269
Respuesta: Menú de navegación con listas

Prueba con esto, el código está comentado.
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  3.     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  4.     <title></title>
  5.     <style type="text/css">
  6.         * { padding: 0; margin: 0; } /*margin:0 auto; no es bueno darselo a todos los elementos, ya que por defecto estarías centrando todo*/
  7.        
  8.         #menus {
  9.             position: relative;
  10.             width: 697px;
  11.             top: 180px;
  12.             margin: 0 auto;
  13.         }
  14.         /*overflow:hidden, xq el ul contendrá li flotados*/
  15.         #menus ul {
  16.             height: 198px;
  17.             background-color:#9F1A1A;
  18.             overflow:hidden;  
  19.         }
  20.         /*flotamos los li, damos ancho fijo, centramos vertical con line-height (nota como line-height es igual a height) y horizontal con text-align*/    
  21.         #menus ul li{
  22.             width:174px;
  23.             float:left;
  24.             font-size: 42px;
  25.             font-family: "MoolBoran";
  26.             text-align:center;
  27.             line-height:198px;
  28.             list-style:none;
  29.         }
  30.         /*convertimos a bloque el enlace para darle alto y ancho*/        
  31.         #menus ul li a{
  32.             display:block;
  33.             width:174px;
  34.             height: 198px;
  35.             color:#fff;
  36.             text-decoration:none;
  37.         }
  38.         #menus ul li a:hover{
  39.             background:#2e2e2e;
  40.         }
  41.     </style>
  42. </head>
  43. <body>
  44.     <div id="menus">
  45.         <ul>
  46.             <!-- necesitaras <a> (enlaces) para el menú-->
  47.             <li><a href="#">Portada</a></li>
  48.             <li><a href="#">Portafolio</a></li>
  49.             <li><a href="#">Testimonios</a></li>
  50.             <li><a href="#">Contacto</a></li>
  51.         </ul>
  52.     </div>
  53. </body>
  54. </html>