Lo más básico
Las páginas web están escritas en HTML ("HyperText Markup Language", Lenguaje de Marcas de Hipertexto) y son archivos de texto con extensión .html que contienen instrucciones que serán interpretadas por el navegador.
Al programar páginas web hay que escribir código que verifique los estándares del W3C ("World Wide Web Consortium"), la organización que desarrolla los estándares para Internet. Para asegurarnos de que nuestro código valida utilizaremos los validadores del W3C.
Recursos
- Referencia de HTML del W3C: HTML 4.01 Specification
- Referencia de CSS del W3C: CSS 2.1 Specification
- Validador de HTML del W3C: W3C HTML validator
- Validadores de CSS del W3C: W3C CSS validator
Etiquetas
Las instrucciones HTML son denominadas etiquetas o tags y su sintaxis básica es la siguiente:
<etiqueta>Texto</etiqueta> |
Atributos
Algunas etiquetas admiten atributos que permiten modificar sus características. Su sintaxis es:
<etiqueta atributo_1="valor_1" atributo_2="valor_2">Texto</etiqueta> |
Recursos
- Etiquetas HTML 4.01: Tags ordered alphabetically
Secciones de un documento HTML
Un documento HTML genérico será similar a:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Hello World</title> </head> <body> <h1>Hello World</h1> </body> </html> |
Podemos diferenciar tres secciones básicas en un documento HTML:
- Declaración de tipo de documento
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> </html>
- <!DOCTYPE>
Define el tipo de documento. La primera palabra tras DOCTYPE es el tag raíz, en este caso html.
- <html></html>
Indica al navegador el inicio y el final del documento HTML.
- <!DOCTYPE>
- Cabecera o head
<head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Hello World</title> </head>
- Cuerpo o body
<body> <h1>Hello World</h1> </body>
- <body></body>
Define el cuerpo del documento HTML y su contenido sí es visible en el navegador.
- Etiquetas que suelen aparecer en el body (alfabéticamente):
<!– –>, <a>, <abbr>, <acronym>, <address>, <area />, <b>, <bdo>, <big>, <blockquote>, <br />, <button>, <caption>, <center>, <cite>, <code>, <col />, <colgroup>, <dd>, <del>, <div>, <dfn>, <dl>, <dt>, <em>, <fieldset>, <font>, <form>, <frame />, <frameset>, <h1> – <h6>, <hr />, <i>, <iframe>, <img />, <input />, <ins>, <kbd>, <label>, <legend>, <li>, <map>, <nobr>, <noframes>, <noscript>, <object>, <ol>, <optgroup>, <option />, <p>, <param />, <pre>, <q>, <s>, <samp>, <script>, <select>, <small>, <span>, <strike>, <strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, <tr>, <tt>, <u>, <ul>, <var>.
- <body></body>
Recursos
- Etiquetas HTML 4.01: Tags ordered alphabetically