write html with tailwind styling
- User
write html with tailwind styling
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
write html with tailwind styling
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Here's an example of an HTML file with Tailwind CSS styling:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<title>Tailwind CSS Example</title>
</head>
<body>
<div class="container mx-auto px-4">
<header class="py-6">
<h1 class="text-4xl font-bold text-center text-blue-600">Welcome to My Website</h1>
</header>
<main class="mt-8">
<section class="bg-gray-100 rounded-lg p-6 mb-8">
<h2 class="text-2xl font-semibold mb-4">About Us</h2>
<p class="text-gray-700">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam at velit vel metus bibendum
malesuada. Sed euismod, nulla sit amet aliquam lacinia, nisl nisl aliquam nisl, nec aliquam
nisl nisl sit amet nisl.
</p>
</section>
<section class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-white rounded-lg shadow-md p-6">
<h3 class="text-xl font-semibold mb-2">Feature 1</h3>
<p class="text-gray-600">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam at velit vel metus bibendum
malesuada.
</p>
</div>
<div class="bg-white rounded-lg shadow-md p-6">
<h3 class="text-xl font-semibold mb-2">Feature 2</h3>
<p class="text-gray-600">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam at velit vel metus bibendum
malesuada.
</p>
</div>
</section>
</main>
<footer class="bg-gray-800 text-white py-6 mt-8">
<p class="text-center">© 2023 My Website. All rights reserved.</p>
</footer>
</div>
</body>
</html>
In this example:
We include the Tailwind CSS stylesheet using a CDN link in the <head> section.
We use Tailwind CSS utility classes to style various elements throughout the HTML file.
The container class centers the content and sets a maximum width based on the screen size.
We use classes like text-4xl, font-bold, text-center, and text-blue-600 to style the heading.
The bg-gray-100, rounded-lg, and p-6 classes are used to style the "About Us" section with a gray background, rounded corners, and padding.
We create a grid layout using grid, grid-cols-1, and md:grid-cols-2 classes to display two feature sections side by side on larger screens and stacked on smaller screens.
The bg-white, rounded-lg, shadow-md, and p-6 classes are used to style the feature sections with a white background, rounded corners, a shadow effect, and padding.
Finally, we style the footer with a dark gray background using bg-gray-800 and white text using text-white.
This is just a basic example to demonstrate how you can use Tailwind CSS utility classes to style an HTML file. Tailwind CSS provides a wide range of pre-defined classes that you can use to quickly style your elements without writing custom CSS.