Diferencia entre revisiones de «Lenguaje XHTML»

Contenido eliminado Contenido añadido
Sin resumen de edición
Sin resumen de edición
Línea 33:
 
==Un Documento XHTML Básico==
Now,Vamos we'reahora goinga tohacer makeun adocumento simple en XHTML document. AsComo Imencionamos said beforeantes, theel documentdocumento startsempieza withcon anun tag <html> tag.y Thetermina documentcon alsoel ends withtag </html>. TheEl tag HTML tages isllamado referedtambién toel astag the''raíz'' (''root'' elementen inglés). WithinDentro thosede estos tags, therehay aredos twoelementos elements nestedanidados: theEl elemento <head> element andy theel elemento <body> element. OfPor coursesupuesto, otherotros elementselementos maypueden beestar nestedanidados oro sub-nestedanidados dentro withinde theseestos elementselementos.
Por ahora usaremos el elemento <head> sólo para alojar el elemento <title>. El elemento título debe ir entre los tags <title> de inicio y de fin.
 
Entonces la sintaxis total del elemento <head> para que incluir el ''título'' "wikibooks" es:
The <head> element is, for now, only to house the <title> element. The title is put between the <title> begin and end tags. So the overall syntax of the <head> element is, for a title of "WikiBooks":
 
<head>
Línea 43:
</head>
 
OfPor course,supuesto thisque cannotesto besólo inno apuede ser un archivo .html file alone, butpero makingconvertirlo thisen intoun a completearchivo XHTML filecompleto isn'tno muches moremucho worktrabajo adicional. AsComo Imencionamos already saidantes, youdebes haveponer toun put antag <html> tagque aroundencierre theabsolutamente wholea thingtodo. ButPero younecesitarás alsoalgo needpara aalmacenar placeel forcontenido, thepara content.eso Hence,está el theelemento <body> element. TheEl elemento <body> elementdebe isponerse putdentro withindel theelemento <html> element. ForPor nowahora, we'llsólo justpondremos puttexto textdento withindel theelemento <bodyhtml> element. TheEste texttexto willserá showmostrado upen inla mostmayoría browsersde inlso Newnavegadores con la tipografía Times News Roman 12-point fontcolor andnegro wrapped around the screen. Any kind of whitespace will show up as one space. So here's a sample XHTML document with the title "WikiBooks" and the content "Wikibooks is ay greatfondo websiteblanco.":
Tenemos entonces un ejemplo de XHTML con el título "Wikibooks" y el contenido "Wikibooks is a great website":
 
<div style="float:right">[[Image:Wikibooksgreatwebsite.png]]<br/> <center>[[media:WikiBooks.html|Download file]]</center></div>
 
Línea 59 ⟶ 61:
&lt;/html&gt;
 
Now you can put this in a text editor, save it into an .html file, and open it in your web browser. This document, although it works in 99% of XHTML browsers, isn't actually valid because it lacks a doctype.
 
Ahora puedes copiar este ejemplo, pegarlo en un editor de texto, guardarlo con la extensión .html, y abrirlo en tu navegador.
A doctype tells the browser what type of document the file is. In HTML, doctypes were optional, but in XHTML, they are mandatory. We will be using the XHTML 1.0 Strict doctype, the code of which is shown below:
Aunque este documento funciona en el 99% de los navegadores que soportan XHTML, aún no es un docmuento válido porque no hemos indicado el tipo de dcomuento (''Doctype'').
El ''doctype'' sirve para indicarle al navegador qué tipo de documento es el archivo. En HTML, la etiqueta ''doctype'' es opcional, pero en XHTML, es obligatoria. Nosotros usaremos el doctype XHTML 1.0 Stric (XHTML 1.0 estricto), cuyo código mostramos a continuación:
 
&lt;!DOCTYPE html
Línea 67 ⟶ 70:
<nowiki>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</nowiki>
 
Esto debería estar en el comienzo de cada documento XHTML. Después de incluir el ''doctype'', nuestra página de ejemplo debería verse igual en el 100% de los navegadores.
That should be placed at the very beginning of an XTHML document. After including the doctype, the page should look exactly the same.
 
==Vínculos==
Los hipervículos, generalmente abreviados como vínculos, son parte fundamental del Internet. Un vínculo te traslada de un documento a otro solo haciendo click sobre él. Por defecto, en la mayoría de navegadores aparecen azules y con subrayado. Cuando se pasa el puntero del ratón sobre unvínculoun vínculo, en la mayoría de navegadores, el puntero cambia a la forma de una mano con el dedo índice extendido.
 
Como fue explicado anteriormente, para crear un vínculo, se usa la etiqueta &lt;a&gt;, y se usa el atributo <code>href</code> para definir a donde se desea ir. El texto que el vínculo mostrará debería estar dentro del elemento &lt;a&gt;. Por lo tanto, si se desea escribir "[http://www.wikibooks.org/ Click aquí] para ir a Wikibooks.org." Se debería escribir: