Using Head Tag In Svelte – Svelte Head example

In this article, you will learn How To Add Head Tag In Svelte. In Svelte you get a tag for adding all the functionality of…

The post Using Head Tag In Svelte – Svelte Head example appeared first on CodeSource.io.


This content originally appeared on CodeSource.io and was authored by Jatin Hemnani

In this article, you will learn How To Add Head Tag In Svelte.

In Svelte you get a tag for adding all the functionality of <head> tag like adding a title and CSS CDN(like bootstrap).

Adding Head Tag

<svelte:head>
	<title>Svelte is Great</title>
	<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet" />
</svelte:head>

Here, we have a <svelte:head> tag which is provided by Svelte. We have a title and a CDN of Tailwind CSS to add some styles. You can add anything which you do in a normal HTML <head> tag. NOTE: You can’t use this tag inside another.

<svelte:head>
	<title>Svelte is Great</title>
	<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet" />
</svelte:head>

<div class="p-5 bg-purple-500 hover:bg-purple-300 text-white transition duration-500 text-center">Hello world!</div>

Result Of The Above Code

The post Using Head Tag In Svelte – Svelte Head example appeared first on CodeSource.io.


This content originally appeared on CodeSource.io and was authored by Jatin Hemnani


Print Share Comment Cite Upload Translate Updates
APA

Jatin Hemnani | Sciencx (2021-02-19T15:33:57+00:00) Using Head Tag In Svelte – Svelte Head example. Retrieved from https://www.scien.cx/2021/02/19/using-head-tag-in-svelte-svelte-head-example/

MLA
" » Using Head Tag In Svelte – Svelte Head example." Jatin Hemnani | Sciencx - Friday February 19, 2021, https://www.scien.cx/2021/02/19/using-head-tag-in-svelte-svelte-head-example/
HARVARD
Jatin Hemnani | Sciencx Friday February 19, 2021 » Using Head Tag In Svelte – Svelte Head example., viewed ,<https://www.scien.cx/2021/02/19/using-head-tag-in-svelte-svelte-head-example/>
VANCOUVER
Jatin Hemnani | Sciencx - » Using Head Tag In Svelte – Svelte Head example. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/02/19/using-head-tag-in-svelte-svelte-head-example/
CHICAGO
" » Using Head Tag In Svelte – Svelte Head example." Jatin Hemnani | Sciencx - Accessed . https://www.scien.cx/2021/02/19/using-head-tag-in-svelte-svelte-head-example/
IEEE
" » Using Head Tag In Svelte – Svelte Head example." Jatin Hemnani | Sciencx [Online]. Available: https://www.scien.cx/2021/02/19/using-head-tag-in-svelte-svelte-head-example/. [Accessed: ]
rf:citation
» Using Head Tag In Svelte – Svelte Head example | Jatin Hemnani | Sciencx | https://www.scien.cx/2021/02/19/using-head-tag-in-svelte-svelte-head-example/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.