Hello there!
Let's learn something today.
Pharmasift Part I
Frontend
Beginner
2. Setting up Tailwind
Setting up Tailwind CSS with a CDN (Content Delivery Network) is a straightforward way to start using Tailwind in your web project without npm or complex configurations.
TIP - Senior developers usually read Official Documentation before implementing any tool. You should consider learning more about Tailwind here
Key Points:
Linking Tailwind:
Including Tailwind CSS by adding a link in the HTML file's
<head>
section.<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet" />
Applying Tailwind Classes:
Start using Tailwind's utility classes directly in your HTML file to style elements effortlessly.
<div class="p-4 bg-blue-500 text-white">Hello, Tailwind!</div>
Checking Tailwind Styling
After adding the Tailwind CDN link in your HTML file, create a sample element and apply a Tailwind class to see if it styles as expected.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Tailwind Test</title>
<!-- Add Tailwind CSS via CDN -->
<link
href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css"
rel="stylesheet"
/>
</head>
<body>
<!-- Test Element -->
<div class="p-4 bg-blue-500 text-white">
Hello, Tailwind! This should be styled.
</div>
</body>
</html>
Save this HTML file and open it in a web browser. If Tailwind has been added successfully, the test element should be styled with a blue background, white text, and some padding.
đ„ł Wow. You just integrated & edited a Tailwind Website.
More interesting chapters ahead, Keep Going.