I would like to place a heading in Vuetify.
I noticed that you could use either the <h1>
element or the text-h1
class. What is the difference between them? It seems that the latter one has a bigger font size.
So I came up with three ways:
<h1>Heading 1</h1>
<div class="text-h1">Heading 1</div>
<h1 class="text-h1">Heading 1</h1>
Which one is the recommended way of placing a heading?
3
Answers
This can be figured out by simply opening your browser’s dev tools and inspecting the element. The class
text-h1
will have some CSS associated with it.It’s up to you decide what style you prefer, there is no right or wrong answer.
The main difference between using a
<div>
and a<h1>
is the HTML semantics.Please refer to Semantics in HTML documentation to find out why they’re important.
Using H1 tag versus text-h1 class has the following differences:
Visual vs Semantic Meaning
While you might see little visual difference, using the H1 tag communicates to search engines that the text within this tag contains the most important keywords on your page and helps with SEO optimization. When using other tags with styling classes, they carry no semantic meaning for search engines.
Important Note
Each page should contain exactly one H1 tag.
Code Example
SEO Impact
The H1 tag: