Monday, 3 December 2012

28 HTML5 features, tips and techniques you need to know

1. New Doctype

Even though annoying, impossible to remember XHTML document type?



       <DOCTYPE HTML PUBLIC "- / / W3C / / DTD XHTML 1.0 Transitional / / EN"
           "Http :/ / www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

If so, why? The transition to a new type of document HTML5. You will live longer - as Douglas Quaid might say.


       <! DOCTYPE HTML>

In fact, you know, it's really not even really necessary for HTML5? However, it is used for modern browsers, and older requiring this type of document. Browsers that do not understand this type of document, simply make content markup in standards mode. So, no worries, do not hesitate to throw caution to the wind and make a new document type HTML5.

2. The Figure Element

Consider the following image markup:
view plaincopy to clipboardprint?

       <img src="path/to/image" alt="About image" />
       <p> images of Mars. </ P>

There are, unfortunately, there is no easy way associated or semantic label wrapped in a paragraph tag with an image of the item itself. HTML5 will fix this with the introduction <figure> element. In combination with <figcaption> elements, we can now associate with the signature image semantics colleagues.
view plaincopy to clipboardprint?


       <figure>
           <img src="path/to/image" alt="About image" />
           <figcaption>
               <p> something interesting. </ P>
           </ Figcaption>
       </ Form>

 

 

3. <small> Redefined

 Not long ago, I used to create the element of subheadings <small>, which are closely linked to logotipom.Displey element is useful, however, now it would be wrong ispolzovanie.Maly element has been revised more correct to refer to the fine print. Imagine the copyrights in the basement of your site, according to a new definition of the HTML5 element, <small> would be correct wrapper for this information.

 4. No More Types for Scripts and Links


You possibly still add the type attribute to your link and script tags.



    <link rel="stylesheet" href="path/to/stylesheet.css" type="text/css" />
    <script type="text/javascript" src="path/to/script.js"></script>

This is no longer necessary. It’s implied that both of these tags refer to stylesheets and scripts, respectively. As such, we can remove the type attribute all together.



    <link rel="stylesheet" href="path/to/stylesheet.css" />
    <script src="path/to/script.js"></script>