Im trying to use title tag with Tailwindcss+React and the title itself disappears. If I delete the tag, it’s present.Any thoughts?
I deleted the title tag and write the word into h1 and another tags, and its work
<div className="text-center">
<title className="text-[40px] font-medium">{t("news")}</title>
</div>
2
Answers
The
<title>
HTML tag is only supposed to be used in the<head>
element of a HTML web page to define the webpage’s title that appears in the tab of the browser. It is not meant for presentational display in the page.If you are looking to mark-up a title or heading, consider using a
<h1>
to<h6>
tag that is most appropriate for your context.You can read more about
<title>
in the MDN documentation and also the<h1>
to<h6>
elements.The tag is used to set the document title, which is the text displayed in the browser tab, and not for displaying text within the page content.
If you want to display the text as a heading or title within your page, you should use a different HTML element, such as
h1
,h2
, etc.