Diferencia entre revisiones de «Lenguaje XHTML»

Contenido eliminado Contenido añadido
Sin resumen de edición
Sin resumen de edición
Línea 103:
</html>
 
==ParágrafosParrafos e <code>id</code>s==
InEn XHTML, headingslos aretítulos denotedestán bydefinidos thepor los tags &lt;h1&gt;, &lt;h2&gt;,..., &lt;h6&gt;. &lt;h1&gt; ises theel largesttítulo headingmás andgrande y &lt;h6&gt; isel themás smallestpequeño. TheLos headingtítulos forpara auna sectionsección shoulddeberían beser inalguno onede of theseestos tags, but not the actual section. AUn paragraphpárrafo shoulddebe beir placedentre withinlos atags &lt;p&gt; element. AUn párafo no debería incluir su paragraphpropio shouldtítulo notdento includede its headingmismo.
 
Tanto los títulos como los párrafos deben tener el atributo <code>id</code> (pronunciado como la abreviatura de ''identificación''). En HTML, esto se llamaba a veces el atributo <code>name</code>, pero ahora, el atributo <code>name</code> está descontinuado.
Both headings and paragraphs should have the <code>id</code> attribute (pronounced like the abbreviation for identification). In HTML, this was sometimes the <code>name</code> attribute, but now, the <code>name</code> attribute is deprecated. If you wanted to give a paragraph containing the words "This is a paragraph" with the heading of &lt;h1&gt; size saying "Paragraph" and the id "pointless", you'd write:
Vamos a crear ahora un XHTML de ejemplo, pondremos un título que diga "Inicio" y un párrafo que diga "Hola mundo" con el id "contenido":
 
&lt;p id="pointless"h1&gt;Inicio&lt;/h1&gt;
&lt;h1p id="contenido"&gt;ParagraphHola mundo&lt;/h1p&gt;
This is a paragraph
&lt;/p&gt;
 
Every tag in XHTML can have an <code>id</code> attribute. It is recommended to add <code>id</code> attributes to each tag to ensure that users will be able to easily theme your page according to their likings by applying user stylesheets. The <code>id</code> of a block of text or a heading doesn't show up anywhere when this is put into an XHTML document, but it has other uses. For example, if you are linking to a page, it is possible to make the page automatically scroll down until it finds the element with that id. To do that, you'd use a relative path, as explained above. If you are linking to an <code>id</code> on the current page, use the syntax ''#id'' for the desired <code>id</code> that you want to link to. For example, to link to the section with the <code>id</code> Formatting_Text_into_Paragraphs (this section), use the code
 
Todos los tags en XHTML pueden tener un atributo <code>id</code>. Es recomendable añadir dicho atributo a cada tag para asegurarse que los usuarios podrán modificar la estética fácilmente por la que más les guste, por medio de las hojas de estilo. El <code>id</code> de un bloque de texto o de un título no se aprecian en ninguna parte de la página XHTML, pero tiene otros usos. Por ejemplo, si estás vinculando a una página XHTML, es posible hacer abra esa página y luego escrole automáticamente hasta que encuentre el elemento con un cierto id. Para hacer eso, debes usar una ruta relativa como se explicó antes. Si estás vinculando a un <code>id</code> de la página actual, usa la sintaxis ''#nombre_del_id'' para el <code>id</code> al que quieras vincular. Por ejemplo, para hacer un vínculo a la sección con el <code>id</code> parrafos_e_id (esta sección), debes usar el código
&lt;a href="#Formatting_Text_into_Paragraphs"&gt;this section&lt;/a&gt;
 
&lt;a href="#Formatting_Text_into_Paragraphsparrafos_e_id"&gt;thisesta sectionsección&lt;/a&gt;
to get this: [[#Formatting_Text_into_Paragraphs|this section]]. Linking from another website to an <code>id</code> on a page is just as simple. Simply write the URL you want to link to followed by (without any spaces) a # sign and the <code>id</code> you want to link to. So to link to the <code>id</code> "Sister_Projects" on Wikibook's main page, you'd write:
 
para obtener esto: [[#parrafos_e_id|esta sección]]. Vinculando desde otro sitio web al <code>id</code> de una página es muy simple. Sólo escribe la URL que quieres vincular acompañada por un un singo # (sin espacios) y el <code>id</code> al que quieres referenciar. Entonces, para vincular al <code>id</code> "Sister_Projects" de la página principal de Wikibooks debes escribir:
 
&lt;a href="<nowiki>http://wikibooks.org/wiki/Main_Page#Wikibooks'_Sister_Projects</nowiki>"&gt;
Línea 123:
&lt;/a&gt;
 
topara getobtener thisesto: [[Main Page#Wikibooks' Sister Projects]].
 
Let's make a bigger XHTML page to illustrate this better.