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
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/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.