21 April 2020,
 Off
Organic Traffic

HTML5 comes with a bunch of new elements with more to be recommended in the future. However, there are some elements that might be a little confusing in their implementation, including the following two new elements:

and

.

Some most frequently asked questions I found in the forums are: In what circumstances should we use these elements? And similarly, How do we use these elements correctly?

A Look Into Proper HTML5 Semantics

A Look Into Proper HTML5 Semantics

If you carefully plan the structure of your HTML documents, you can help computers make sense of the... Read more

Element

This is probably one of the most ambiguous elements. All these years, we have used

element for sectioning in our web structure. So the question arises as how is it different than

element and when should we use this element apart from

element.

To demystify it, we need to refer to the official documentation. According to WHATWG documentation, the

is described as follows:

“The

element represents a generic section of a document or application. ~ WHATWG”

From that description we can conclude that the

element is definitely intended for sectioning, more or less like a

element. But there is an exception to it. The documentation added some specific extra note that said:

“When an element is needed only for styling purposes or as a convenience for scripting, authors are encouraged to use the div element instead…A general rule is that the section element is appropriate only if the element’s contents would be listed explicitly… ~ WHATWG”

At this point, things got lighter, and we can summarize that description in two points:

  1. Although the section element is technically styleable, it is suggested to use
    instead when we are more likely to apply heavy styles or script to the element.
  2. Similar to
  3. element, the general idea of section element is to list content.

So in real cases, one of the sensible reason to use

element is to structure list of blog post content, as shown in the following code snippet:

Blog Post Title

Ice cream tart powder jelly-o. Gummies chocolate cake ice cream cookie halvah tiramisu jelly-o.

Blog Post Title

Ice cream tart powder jelly-o. Gummies chocolate cake ice cream cookie halvah tiramisu jelly-o.

Blog Post Title

Ice cream tart powder jelly-o. Gummies chocolate cake ice cream cookie halvah tiramisu jelly-o.

This is just an example; we can use this element for other purposes.

Element

The name itself is quite self-explanatory, but let’s see how the official documentation describes it:

“A self-contained composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g., in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.

From the above explanation, we can conclude that

element is exclusively recommended to be used for structuring articles, especially the article that we are likely to syndicate, such as a blog post, page content, or forum posts.

The following example shows how we structure a blog post content with

.

This is Blog Post Title

Sweet roll halvah biscuit toffee liquorice tart pudding sesame snaps. Biscuit powder jelly-o fruitcake faworki chocolate bar. Pudding oat cake tootsie roll sesame snaps lollipop gingerbread bonbon. Gummies halvah gummies danish biscuit applicake gingerbread jelly-o pastry.

Furthermore, the

element can be used in conjunction with the section element, so the article can be divided into several sections with

element when the case is reasonable to do so, such as the example below.

This is Blog Post Title

This is the Sub-Heading

Sweet roll halvah biscuit toffee liquorice tart pudding sesame snaps. Biscuit powder jelly-o fruitcake faworki chocolate bar. Pudding oat cake tootsie roll sesame snaps lollipop gingerbread bonbon. Gummies halvah gummies danish biscuit applicake gingerbread jelly-o pastry.

This is another Sub-Heading

Topping cheesecake sweet pie carrot cake sweet roll. Gummi bears lemon drops toffee sesame snaps tart topping chupa chups apple pie gummies. Wafer chocolate cake. Sugar plum chocolate bar topping ice cream carrot cake danish bonbon. Cheesecake gummi bears dragée jujubes dragée dragée brownie jelly biscuit. Powder croissant jelly beans pastry.

Conclusion

All the new elements in HTML5 are invented to make the web structure more Semantic as how the founder of the World Wide Web and the director of W3C has prevised. There are still being debated among web developers and designers, though, on how to apply these elements more correctly, some say this, others might say differently.

However, don’t get confused with the idea. As I have mentioned above, as long as the case is reasonable to use them and you see that the structure is quite meaningful when you examine it, then go for it. After all, it does not matter in the end.

The post A Look Into: HTML5

Comments are closed.

s2Member®