DEV Community

Cover image for Top 5 HTML Features You’re Not Using (But Should Be)

Top 5 HTML Features You’re Not Using (But Should Be)

Safdar Ali on August 20, 2024

HTML is the foundation of web development. While most developers are familiar with the basic elements like <div>, <p>, and <img&g...
Collapse
 
tomasdevs profile image
Tomas Stveracek

Great article! Another cool feature to explore is the <template> tag. It lets you define reusable HTML that you can add to the DOM later with JavaScript, without rendering it right away. Perfect for dynamic content.

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️ • Edited

Dialogue elements are cool in theory, but I've always found them a bit inconvenient to style in practice. There's no way for the CSS to query how they're being shown, so without weird hacks, getting them to play nicely with both show() and showModal() is a bit of a pain.

EDIT: After a bit more digging, I figured out that :modal is a thing now, so that should (hopefully) make using dialogues a lot more doable than I remember. Now all it's missing is an open event.

Collapse
 
jonrandy profile image
Jon Randy 🎖️

Just use a MutationObserver on the open attribute?

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

That should just be a built-in feature though. It's not like we couldn't already build your own pop-over dialogues before <dialog>, but the point is to provide that out of the box.

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

Might want to proofread this 👍

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
safdarali profile image
Safdar Ali

Sure Jon you can definitedly do that!! I'll be happy if you read my blog.

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

Well, all the tags you've added are invisible - making the post essentially unreadable

EDIT: I see you've fixed it 👍

Thread Thread
 
safdarali profile image
Safdar Ali

Thank s for your feedback!

Collapse
 
martinbaun profile image
Martin Baun

Jeez, HTML has some good features, but sometimes they can be ugly and difficult to style! Great piece regardless, thanks for this!

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
safdarali profile image
Safdar Ali

Great to hear that! Do subscribe my YouTube Channel

Collapse
 
sanwal_mumtaz_116db1f647f profile image
Sanwal Mumtaz

Great job Mr Safdar👌

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
safdarali profile image
Safdar Ali

Thanks Sanwal❤

Collapse
 
ibr_nzr_0516 profile image
Ibrahim Naziru

I need some body who can teach me html, css +2439067658762

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
safdarali profile image
Safdar Ali

Glad to hear that Ibrahim❤ do subscribe my YouTube Channel. I can do that you can share your details @ 00alisafdar@gmail.com. I can teach you that.

Collapse
 
soumya_17_ profile image
Soumya Ranjan 🎖️

I have Just created an account and read this, It was my first reading 😂😂

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
safdarali profile image
Safdar Ali • Edited

Glad to hear that❤. Do subscribe my YouTube Channel

Collapse
 
gunymedian_e1df1644219d8c profile image
Gunymedian

This is useful.
esp. Details and Summary Elements.
Thanks.

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
safdarali profile image
Safdar Ali

Glad to hear that❤ do subscribe my YouTube Channel

Collapse
 
progkidscom profile image
ProgKids

Amazing post, thanks!

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
safdarali profile image
Safdar Ali • Edited

Glad to hear that❤ do subscribe my YouTube Channel

Collapse
 
blessedtechie profile image
Blessing Emejulu

As frontend developer, I use picture tag when I have different images to display on across different screen sizes

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
goteguru profile image
Gergely Mészáros

also, the interface can be much cleaner now. You don't have to type some obscure mess like document.getElementById('myDialog').showModal() , just write myDialog.showModal().
also, dialog elements can be closed by simply set the inner form method to "dialog" by using the method or the form-element's formmethod prop. So you can do something like this:
<dialog id="mydialog">
<form method="dialog">
complex form here...
<button id="ok" >OK</button>
</form>
</dialog>

no boilerplate needed.

Collapse
 
roshan_khan_28 profile image
roshan khan

that dialouge feature was really helpful to give a popup when a user exits my website

Collapse
 
safdarali profile image
Safdar Ali

Great to hear that! Do subscribe my YouTube Channel

Collapse
 
brandon_noronha_711cf5c91 profile image
Brandon Noronha

Great article sir! 😀👍 Didn't know about these elements before!

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
safdarali profile image
Safdar Ali

Glad to hear that Brandon❤ do subscribe my YouTube Channel

Collapse
 
jeromfdolk profile image
Jerom Fernando

Thank you for the post <3

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
safdarali profile image
Safdar Ali

Glad to hear that❤

Collapse
 
codepapa360 profile image
Alamin

I'm gonna use dialogue, data and output a lot. I knew picture element, details & summary though. Thanks for sharing 😊

Collapse
 
safdarali profile image
Safdar Ali

If you found my content helpful or interesting, and you’d like to show your appreciation, why not buy me a coffee? It’s a small gesture that goes a long way in helping me keep creating more content for you.

Just click the button below to support:

Buy Me A Coffee

Collapse
 
safdarali profile image
Safdar Ali

Subscribe to my YouTube Channel if you find it helpful! Subscribing is free, and it will motivate me to stay active here. 😊

Collapse
 
goodevilgenius profile image
Dan Jones

In my opinion, the <data> element is pretty useless.

It's poorly defined. It doesn't have any way of declaring what the value means in that context. So, web crawlers can't parse any useful information from them.

It could be useful if you want someone to scrape data from your site, if you have documented somewhere what the value means. But, if you want to make your data available, just make an API; don't make people scrape your site.

There is a related tag, though, that's better defined and much more useful: the <time> tag.

Collapse
 
westonruter profile image
Weston Ruter

The Output Element example can be further simplified by eliminating the use of parseInt(input.value) in favor of input.valueAsNumber:

<form oninput="result.value = a.valueAsNumber + b.valueAsNumber">
    <input type="number" id="a" value="0"> +
    <input type="number" id="b" value="0">
    = <output name="result" for="a b">0</output>
</form>
Enter fullscreen mode Exit fullscreen mode
Collapse
 
columk1 profile image
Colum Kelly

The element is essential for creating responsive images that adapt to different screen sizes and resolutions. It allows you to specify multiple image sources and choose the best one based on the device’s capabilities.

You can do this with a single img tag using the sizes and srcset attributes. Picture is used when you also want to change the aspect ratio of the image.

Collapse
 
eliskaholwe profile image
Elis Kaholwe • Edited

Well, but there's much you can achieve with React JSX and some built in Next.js tags.

Collapse
 
oussamabouyahia profile image
Oussama Bouyahia

The most important thing here is also to emphasize how is important to use semantic HTML , make the code more readable

Collapse
 
gptcaller profile image
Gptcaller

Did chatgpt write this?