HTML5 New Elements

New Elements in HTML5

The internet has changed a lot since HTML 4.01 became a standard in 1999.

Today, some elements in HTML 4.01 are obsolete, never used, or not used the way they were intended to. These elements are deleted or re-written in HTML5.

To better handle today’s internet use, HTML5 also includes new elements for better structure, drawing, media content, and better form handling.

New Markup Elements

New elements for better structure:

Tag Description
<article> Specifies independent, self-contained content, could be a news-article, blog post, forum post,
or other articles which can be distributed independently from the rest of the site.
<aside> For content aside from the content it is placed in. The aside content should
be related to the surrounding content
<bdi> For text that should not be bound to the text-direction of its parent elements
<command> A button, or a radiobutton, or a checkbox
<details> For describing details about a document, or parts of a document
<summary> A caption, or summary, inside the details element
<figure> For grouping a section of
stand-alone content, could be a video
<figcaption> The caption of the figure section
<footer> For a footer of a document or section, could include the name of the author, the
date of the document, contact information, or copyright information
<header> For an introduction of a document or section, could include navigation
<hgroup> For a section of headings, using <h1> to <h6>, where the largest is the main
heading of the section, and the others are sub-headings
<mark> For text that should be highlighted
<meter> For a measurement, used only if the maximum and minimum values are known
<nav> For a section of navigation
<progress> The state of a work in progress
<ruby> For ruby annotation (Chinese notes or characters)
<rt> For explanation of the ruby annotation
<rp> What to show browsers that do not support the ruby element
<section> For a section in a document. Such as chapters, headers, footers, or any
other sections of the document
<time> For defining a time or a date, or both
<wbr> Word break. For defining a line-break opportunity.

New Media Elements

HTML5 provides a new standard for media content:

Tag Description
<audio> For multimedia content, sounds, music or other audio streams
<video> For video content, such as a movie clip or other video streams
<source> For media resources for media elements, defined inside video or audio
elements
<embed> For embedded content, such as a plug-in
<track> For text tracks used in mediaplayers

The Canvas Element

The canvas element uses JavaScript to make drawings on a web page.

Tag Description
<canvas> For making graphics with a script

New Form Elements

HTML5 offers more form elements, with more functionality:

Tag Description
<datalist> A list of options for input values
<keygen> Generate keys to authenticate users
<output> For different types of output, such as output written by a script

New Input Type Attribute Values

Also, the input element’s type attribute has many new values, for better input control before sending it to the server:

Type Description
tel The input value is of type telephone number
search The input field is a search field
url The input value is a URL
email The input value is one or more email addresses
datetime The input value is a date and/or time
date The input value is a date
month The input value is a month
week The input value is a week
time The input value is of type time
datetime-local The input value is a local date/time
number The input value is a number
range The input value is a number in a given range
color The input value is a hexadecimal color, like #FF8800
placeholder Specifies a short hint that describes the expected value of an input field

HTML5 Introduction

What is HTML5?

HTML5 is the next generation of HTML.

HTML5 will be the new standard for HTML, XHTML, and the HTML DOM.

The previous version of HTML came in 1999. The web has changed a lot since then.

HTML5 is still a work in progress. However, most modern browsers have some HTML5 support.

How Did HTML5 Get Started?

HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG).

WHATWG was working with web forms and applications, and W3C was working with XHTML 2.0. In 2006, they decided to cooperate and create a new version of HTML.

Some rules for HTML5 were established:

  • New features should be based on HTML, CSS, DOM, and JavaScript
  • Reduce the need for external plugins (like Flash)
  • Better error handling
  • More markup to replace scripting
  • HTML5 should be device independent
  • The development process should be visible to the public

New Features

Some of the most interesting new features in HTML5:

  • The canvas element for drawing
  • The video and audio elements for media playback
  • Better support for local offline storage
  • New content specific elements, like article, footer, header, nav, section
  • New form controls, like calendar, date, time, email, url, search

Browser Support

HTML5 is not yet an official standard, and no browsers have full HTML5 support.

But all major browsers (Safari, Chrome, Firefox, Opera, Internet Explorer) continue to add new HTML5 features to their latest versions.

Agregar meta tags de Facebook en Joomla (Open Graph Meta Tags)

Para poder agregar las etiquetas meta vinculadas al botón “Me Gusta” de Facebook y de esta forma decirle a Facebook por ejemplo que imagen, título y url usar, hay que definir en el Head algunas meta etiquetas agregando esta información.

Etiquetas de Facebook:

  <title>The Rock (1996)</title>
  <meta property="og:title" content="The Rock"/>
  <meta property="og:type" content="movie"/>
  <meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
  <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>
  <meta property="og:site_name" content="IMDb"/>
  <meta property="fb:admins" content="USER_ID"/>
  <meta property="og:description"
        content="A group of U.S. Marines, under command of
                 a renegade general, take over Alcatraz and
                 threaten San Francisco Bay with biological
                 weapons."/>
  ...

A continuación mostramos las sentencias que usamos para agregar las Meta Tags en Joomla.

$document = & JFactory::getDocument(); 
$document->addCustomTag( '<meta property="og:title" content="The Rock"/>' ); 
$document->addCustomTag( '<meta property="og:type" content="movie"/>' ); 
$document->addCustomTag( '<meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>' ); 
$document->addCustomTag( '<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>' ); 
$document->addCustomTag( '<meta property="og:site_name" content="IMDb"/>' ); 
$document->addCustomTag( '<meta property="og:description" content="A group of U.S. Marines, under command of a renegade general, take over Alcatraz and threaten San Francisco Bay with biological weapons."/>' ); 

//Otro ejemplo
global $mainframe;
$document = & JFactory::getDocument();
$document->addCustomTag('<meta property="og:title" content="'.$Title.'"/>' );
$document->addCustomTag('<meta property="og:image" content="'.$ImageUrl.'"/>');
$document->addCustomTag('<meta property="og:site_name" content="'.$mainframe->getCfg('sitename').'"/>');
<br/>

Estas sentencias las podemos poner en cualquier parte de nuestro código, modulos, plugins o componentes de Joomla.

Aca les dejo un link con la referencia de Facebook sobre las etiquetas que se pueden usar. Facebook Open Graph

También les presento una forma de setear los Meta Tags ya definidos en Joomla, ver el siguiente ejemplo:

global $mainframe;
$mainframe->addMetaTag( "description", "Tags de Descripcion" );
$mainframe->addMetaTag( "keywords", "Tags Claves" );
$mainframe->addMetaTag( "generator", $Modulo->name.' - v'.$Modulo->version );
// Están los metodos set que también se pueden usar

Deshabilitar el autocompletar de formularios

El auto completado de los campos de tipo texto en los formularios web son de gran ayuda, pero hay veces que queremos deshabilitarlo para el tipo de información que el usuario ingresara, como por ejemplo un numero de documento, o tarjeta de crédito.
Hay dos formas de desabilitar el autocompletado en los formularios.
La primera es indicandolo en el código Html del formulario, o en los compos del mismo, hay que destacar que si usamos la sentencia que desahabilita el autocompletado sobre la etiqueta del formulario la misma tendra prioridad sobre todos los campos del mismo, por lo que si uno quiere hacerlo sobre x campos nada mas, conviene colocarlo en las propiedades de los input, el inconveniente de esta forma de deshabilitar el autocompletado es que no es un estandar validado por la W3C, sino una opción propietaria de Microsoft y por consiguiente a la hora de validar el Html dara problemas.

Ejemplos de la primera opción de deshabilitar el atucompletado.

 <!-- Ejemplo en Formulario -->
<form method="POST" name="FrmName" id="FrmId" autocomplete="off">
       <!-- elementos del formulario -->
</form>
<!-- Ejemplos autocomplete="off" en campos de tipo text -->
<input  type="text" id="InpId" name="InpName" autocomplete="off" />

Hay que destacar que al no ser un atributo estandar, es probable que algunos exploradores no lo soporten.

Bien ahora pasamos al segundo ejemplo el cual si es soportados por todos los exploradores web y no da problemas con la validacion contra la W3C.
Lo que haremos es setear estos mismos atributos pero mediante el uso de JavaScript.
Declaramos una funcíón JavaScript que hará el trabajo.

<script language="javascript" type="text/javascript">
<!--
    function DisableAutocomplete(Element){
        Element.setAttribute("autocomplete", "off");
    }
-->
</script>

Ahora escribiremos el código Html que hace la llamada a la función JavaScript que agregará el atributo al elmemento Html.

<form method="post" id="FrmId" action="">
      <input  type="text"
                 id="InpID" 
                 name="InpName" 
                 value=""
                 onchange="DisableAutocomplete(this);"
                 />
</form>