Generate a semantic HTML and Tailwind CSS "Contact Support" form consisting of the user's name, email, issue type, and message. The form elements should be stacked vertically and placed inside a card.
时间: 2024-03-08 20:48:32 浏览: 76
angular-tailwindcss-app:使用 TailwindCSS 的 Angular 应用程序
Sure, here's an example of a semantic HTML and Tailwind CSS "Contact Support" form:
```html
<div class="bg-white shadow-md rounded-md p-6">
<h2 class="text-lg font-medium mb-4">Contact Support</h2>
<form class="grid gap-4">
<div>
<label for="name" class="block text-sm font-medium text-gray-700 mb-2">Name</label>
<input id="name" type="text" name="name" class="w-full border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-500 focus:ring-opacity-50" required>
</div>
<div>
<label for="email" class="block text-sm font-medium text-gray-700 mb-2">Email</label>
<input id="email" type="email" name="email" class="w-full border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-500 focus:ring-opacity-50" required>
</div>
<div>
<label for="issue-type" class="block text-sm font-medium text-gray-700 mb-2">Issue Type</label>
<select id="issue-type" name="issue-type" class="w-full border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-500 focus:ring-opacity-50" required>
<option value="">Select an issue type</option>
<option value="billing">Billing</option>
<option value="technical">Technical</option>
<option value="other">Other</option>
</select>
</div>
<div>
<label for="message" class="block text-sm font-medium text-gray-700 mb-2">Message</label>
<textarea id="message" name="message" rows="4" class="w-full border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-500 focus:ring-opacity-50" required></textarea>
</div>
<div>
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent text-base font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
Submit
</button>
</div>
</form>
</div>
```
In this example, the form is contained within a `div` with a white background, a shadow, and rounded corners. The form includes a heading, a grid of form elements, and a submit button. Each form element has a label and input or select element, and all elements have appropriate Tailwind CSS classes to style them. The form is responsive and will adjust to different screen sizes.
阅读全文