HTML Tips You Might Not Know

HTML Tips You Might Not Know

ยท

1 min read

Here are few handy HTML tips you might not know about !

Refresh the web page every N seconds, or even redirect to another URL

<meta http-equiv="refresh" content="10">

Refreshes the page every 10 seconds

<meta http-equiv="refresh" content="0; url=https://hashnode.com">

Redirects instantly to hashnode

Dialog box that can be opened and closed with Javascript

<dialog open>This is a dialog box</dialog>

Sets the toolbar color for browsers (e.g. Chrome for Android)

<meta name="theme-color" content="#f1c40f">

Native HTML color picker

<input type="color">

Toggable block of content with summary and additional details

<details>
<summary>Lorem Ipsum</summary>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
</details>

Defines an abbreviation or an acronym

<abbr title="Hypertext Markup Language">HTML</abbr>

Defines a progress bar

<progress value="1">Progress</progress>

Tooltip text for an element

<p title="I'm a tooltip">Hover over me</p>

Defines small text for less important content

<small>Posted on Oct 14</small>

sup and sub - Defines text that displays higher and lower

<p>2<sup>n</sup></p>
<p>CO<sub>2</sub></p>

Defines a specific period in time

The movie starts at <time datetime="2020-10-14T19:00">19:00</time>.

del and ins - Defines deleted and inserted text

<p>Spread <del>Hate</del> <ins>Love</ins></p>

Defines highlighted text

<p>HTML is a <mark>PROGRAMMING</mark> language ๐Ÿ˜†</p>