Article introduction of Wulin.com (www.vevb.com): The development of Internet technology is amazingly fast. If you are not careful, you may not be able to keep up with it. The changes and updates of HTML5 have also overwhelmed many people. This article will introduce some of the most basic and very necessary HTML techniques to you.
The development of connected technology is amazingly fast. If you are not careful, you may not be able to keep up with it. The changes and updates of HTML5 have also overwhelmed many people. This article will introduce some of the most basic and very necessary HTML techniques to you.
1. New document type (Doctype)
Are you still using the above XHTML document type that is both troublesome and difficult to remember? If this is still the case, it's time to switch to the new HTML5 document type.
Just such a simple 15 characters. (Note: Your doctype declaration needs to appear on the first line of your html file.)
2. Graphics (Figure) elements
Consider using the following code to mark images?
Unfortunately, it cannot be associated with the title of the graph in a simple, semantic way, because it is simply wrapped with paragraph markers and image elements, and HTML5 improves this by introducing <figure> elements. When used in conjunction with the <figcaption> element, we can pair the graphic title with the graphic. The code is as follows:
3. Redefine <small>
It turns out that you can use the <small> element to create subtitles closely related to the logo. However, now HTML5 has modified this usage, and the <small> element has been redefined, or more appropriately, it is now used to represent small words or other side notes (such as copyright notice at the bottom of the website).
4. No more scripts or link types are needed
Most likely you are still adding properties of type to your links and script tags like the code below.
In HTML5, this is no longer needed. It means that these two labels represent styles and scripts respectively. Therefore, we can delete all their type attributes. The code is as follows:
5. Use or not quotes
Remember, HTML5 is different from XHTML, and you don't have to wrap the attributes in quotes if you don't like it. However, if you think using quotes will make you feel more comfortable, of course there will be no problems.
6. Make your content editable
One of the very powerful features of HTML5 is contenteditable, which, as the name implies, will allow the user to edit any text content contained within an element (including his child elements). It has a wide range of uses, such as simple task lists or wiki-based sites, and one of its advantages is that it utilizes local storage.
Or, as the fifth trick says, you can also write the code on line nine like this (without quotes):
7. Email input
If we apply the email type to specify the form of the input, we can command the browser to allow only string input that conforms to the valid email address structure. Although built-in form verification will arrive soon, we cannot rely entirely on this. Older browsers don't understand this email type, they simply return to the normal text box.
When it comes to elements and attributes that the browser supports and does not support, you must know that all browsers are not that reliable at present. For example, Opera only supports email verification if you specify the name attribute. However, it does not support the placeholder attribute (as will be discussed below). Finally, while you can use this form of verification, don't rely too much on it.