Home > Web Front-end > HTML Tutorial > HTML 5.1 learning 14 new features and application examples

HTML 5.1 learning 14 new features and application examples

高洛峰
Release: 2017-02-17 15:51:37
Original
1341 people have browsed it

This article mainly introduces to you the 14 new features and application examples of HTML 5.1. The introduction in the article is very detailed and has certain reference value for everyone. Friends in need can take a look below.

Preface

As we all know, HTML5 belongs to the World Wide Web Consortium (W3C). This organization provides standards for the entire Internet community, and the protocols formed in this way can be used around the world. In November 2016, the W3C updated the long-standing HTML 5 standard, its first minor update in 2 years. Many of the features originally proposed for HTML 5.1 were removed due to design flaws and lack of support from browser vendors.

Although there are some elements and feature improvements that have been brought into HTML 5.1, it is still a small update. Some of the new elements include combination tags, which now include

,
, and , giving developers more ways to express their creativity and content. Space.

The W3C has also started working on the HTML 5.2 draft, which is expected to be released by the end of 2017. What we are here to present are the new features and improvements introduced in version 5.1. You don't need to use javascript to take advantage of these features. Not all browsers support these features, so it's a good idea to check browser support before using them in production.

14. Prevent Phishing Attacks

Most people who use target ='_ blank' don't know an interesting fact - newly opened tabs can be changed window.opener.location to some phishing pages. It will execute some malicious JavaScript code on your behalf on the open page. Because users trust that the page they open is safe, they have no doubts.

To completely eliminate this problem, HTML 5.1 has standardized the usage of the rel="noopener" attribute by isolating the browser context. rel="noopener" can be used in and tags.

<a href="#" target="_blank" rel="noopener">
  The link won&#39;t make trouble anymore
</a>
Copy after login

13. Flexible processing of picture titles

tag indicates that it is associated with the
element A title or legend, often used as a container for visual elements such as pictures, charts, illustrations, etc. In earlier versions of HTML,
could only be used as a child tag of the first or last
. HTML5.1 has relaxed this restriction so that you can now use
anywhere within a
container.

<article>
  <h1>The Headline of todays news </h1>
  <figure>
    <img src="petrolimage.jpeg" alt="Petrol price drops">
    <figcaption>A man fueling up his car at petrol station</figcaption>
  </figure>
  <p>This is the forth hike in petrol prices in two month and the third in case of diesel in one fortnight.</p>
</article>
Copy after login

12. Spellcheck

spellcheck is a value that can be an empty string, true or false Enumeration properties. Specifying its status as true means that the element will be checked for spelling and grammar.

element.forceSpellCheck() will force user agents to report checked spelling and grammatical errors on text elements, even if the user never focused input on that element.

<p spellcheck="true">
 <label>Name: <input spellcheck=" false" id="textbox"></label>
</p>
Copy after login

11. Empty option

The new version of HTML allows you to create an empty , or