---
title: "Discussion on \"5 Common Mistakes to Avoid in HTML\" | Hashnode"
description: "Discussion on \"5 Common Mistakes to Avoid in HTML\". Hello, amazing people. This article will cover few of the common mistakes that we often do while writing HTML. Let's get straight to it.\n1. Use of Anchor Elements: <a>\nAnchor elements are used to create a hyperlink to a file or a location of a webpag..."
url: "https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [5 Common Mistakes to Avoid in HTML](https://iamshadmirza.hashnode.dev/5-common-mistakes-to-avoid-in-html?utm_source=hashnode&utm_medium=feed)

Hello, amazing people. This article will cover few of the common mistakes that we often do while writing HTML. Let's get straight to it. 1. Use of Anchor Elements: <a> Anchor elements are used to create a hyperlink to a file or a location of a webpag...

Aug 30, 2020 · 3 min read · iamshadmirza.hashnode.dev  
Read the article

-   [#2articles1week](https://hashnode.com/tag/2articles1week)
-   [#html5](https://hashnode.com/tag/html5)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#programming](https://hashnode.com/tag/programming)

## Written by

[Shad Mirza](https://hashnode.com/@iamshadmirza)

@iamshadmirza · Bengaluru, India

  
[View profile](https://hashnode.com/@iamshadmirza)

Building Hashnode

A JavaScript enthusiast and a creator who knows how to use Keyboard, Pen, Pencil, and Gamepad to their fullest.

## Responses 7

Markdown supported · ⌘↵ to post

[Astro TemplePooja](https://hashnode.com/@Arjun007)

[Mar 24, 2022](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/623c1bd07753c274c2ab676c)

i read complete [html anchor tag](https://elementtutorials.com/ref/a.html) .

[Charlie Hayes](https://hashnode.com/@cosmotic)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4cf966093fd46f17fed520)

What's wrong with multiple H1 elements?

[Charlie Hayes](https://hashnode.com/@cosmotic)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4cf966093fd46f17fed520#reply-5f4d4ebb6f2d7874d40609ba)

[Mohd Shad Mirza](https://hashnode.com/@iamshadmirza)

Is the H1 the title of the publication or the individual article? What about main feed that shows the last 5 posts; Should those be H1s? Suppose it's a home page for some company like atlassian; would the H1 be "Atlassian" or maybe "Jira" then a second H1 "BitBucket"?

I guess what I'm getting at is there's no real reason to avoid a second H1 as long as it makes semantic sense.

YEARS ago there was an article that said google penalized for multiple H1; but that has long since been the case. When I researched using multiple H1s a year or so ago, that was the single empirical datapoint. No standard, guideline, or publication had any meaningful justification for avoiding multiple H1s other than the defunct Google ranking algorithm.

Screen readers support it.

[Shad Mirza](https://hashnode.com/@iamshadmirza)

[Sep 1, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4cf966093fd46f17fed520#reply-5f4dd80171849874b3142eec)

[Charlie Hayes](https://hashnode.com/@cosmotic) Having a single `h1` is considered as best practice, yes it doesn't hurt your SEO but having one main title makes more semantically.  
If I have multiple posts per page, I would probably group them and have a top-level heading `h1` while using `h2` on the post title.  
I'm saying this from the reference of MDN Docs.

[Charlie Hayes](https://hashnode.com/@cosmotic)

[Sep 1, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4cf966093fd46f17fed520#reply-5f4ebd593b5d701ee7fedef2)

[Mohd Shad Mirza](https://hashnode.com/@iamshadmirza)

Declaring something best practice, no matter the authority, does not make it right. The MDN documentation is rather empty on supporting evidence:

You should only use one <h1> per page. Using more than one will not result in an error, but using only one is seen as a best practice. It makes logical sense — <h1> is the most important heading, and tells you what the purpose of the overall page is. You wouldn't have a book with more than one title, or a movie with more than one name! Having a single top-level title is also arguably better for screenreader users, and SEO.

[Amarachi Johnson](https://hashnode.com/@amarachukwu)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4ccd395c2aa067f8075aa7)

Thanks for sharing this.

[Shad Mirza](https://hashnode.com/@iamshadmirza)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4ccd395c2aa067f8075aa7#reply-5f4cef641291566df619ab5f)

Glad that you found it helpful. 👏

[Dinys Monvoisin](https://hashnode.com/@dinmon)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4cc7d25c2aa067f8075a36)

Using <div> tag to write add a piece of text to your webpage, is a valid case when to use <div>?

[Shad Mirza](https://hashnode.com/@iamshadmirza)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4cc7d25c2aa067f8075a36#reply-5f4cca345c2aa067f8075a70)

Semantically, you should use div when nothing else makes sense.  
If you just want to group few elements together and it doesn't make sense to use section, header, footer, main, aside, article, nav, etc then go for div.  
Never ever add a text inside a div and use click handler to behave like a button. A div is a container of another item and it should do that only.

[Pankaj Patel](https://hashnode.com/@pankajpatel)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4cbbdf96b55f6819b7df6b)

Good tips for `br` in `p`

I would like to add one suggestion on `a`, try to avoid using `target=_blank` as it breaks the flow of browsing way more than use of `#`

In general, like you said, if you need to use only `#` fro href, try to use `button` but it is useful as jump to top of page can just be achieved by using `#` as `href`

Buttons need more style resets than links and probably that's why I would go for using `a[href="#"]` as having click handlers on text nodes is less recommended

[Shad Mirza](https://hashnode.com/@iamshadmirza)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4cbbdf96b55f6819b7df6b#reply-5f4cc6165c2aa067f8075a16)

Agree, use `target=_blank` only where needed.  
I would consider "jump to the top of the page" as navigation as we are actually navigating the user to the top of the page. Just make sure you take care of "open in new tab" functionality.  
A lot of user does right-click and click something from the menu like copy this link or open in new window/tab. That should not break the functionality.

A clickable item can either navigate the user or do some action. If the behavior is not among these or contains both, we probably need to check the UX if it's correct.

[Pankaj Patel](https://hashnode.com/@pankajpatel)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4cbbdf96b55f6819b7df6b#reply-5f4cc84696b55f6819b7e0b5)

Personally, I take the thumb rule of "if it looks like link, make it behave as link"

Rest should behave as button.

And when making a button, there are multiple ways to do it.

There are various kind of users and one natural instinct for a user is that if it looks like link, they might try to open in new tab. But that is also vary small percentage of users. Normally the non-tech users will browse in a natural flow where app can guide them in a natural flow.

I personally am a heavy user of open in new tab and I have 4-5 windows with at-least 20 tabs in each. I hate my habit of doing this but yeah it happens.

UX is very tricky thing around this and there is no blanket statement to cover this kind of experience. Every use-case is different and need to be handled with specific Usability Testings

[Shad Mirza](https://hashnode.com/@iamshadmirza)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4cbbdf96b55f6819b7df6b#reply-5f4cc9465c2aa067f8075a66)

[Pankaj Patel](https://hashnode.com/@pankajpatel) Makes sense

[Chris Bongers](https://hashnode.com/@dailydevtips)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4c9a543a844e5996537e1d)

Wow nice, and so easy to overlook, even I have made there <br> mistakes before.

[Shad Mirza](https://hashnode.com/@iamshadmirza)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4c9a543a844e5996537e1d#reply-5f4cca4e5c2aa067f8075a74)

I used to do that too 😅. Thanks for reading. Hope it was helpful.

[Bolaji Ayodeji](https://hashnode.com/@bolajiayodeji)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4c93a83a844e5996537dc0)

Thanks for sharing Shad!

[Shad Mirza](https://hashnode.com/@iamshadmirza)

[Aug 31, 2020](https://hashnode.com/posts/5-common-mistakes-to-avoid-in-html/5f4be7063a844e5996537904/comment/5f4c93a83a844e5996537dc0#reply-5f4cca5e5c2aa067f8075a7b)

Thanks for reading 🤝
