پیشنمایش زنده
کد HTML
<div class="mt-4 flex flex-col bg-gray-900 rounded-lg p-4 shadow-sm">
<h2 class="text-white font-bold text-lg">Shipping Label Address Form</h2>
<div class="mt-4">
<label class="text-white" for="name">Name</label>
<input placeholder="Your name" class="w-full bg-gray-800 rounded-md border-gray-700 text-white px-2 py-1" type="text">
</div>
<div class="mt-4">
<label class="text-white" for="address">Address</label>
<textarea placeholder="Your address" class="w-full bg-gray-800 rounded-md border-gray-700 text-white px-2 py-1" id="address"></textarea>
</div>
<div class="mt-4 flex flex-row space-x-2">
<div class="flex-1">
<label class="text-white" for="city">City</label>
<input placeholder="Your city" class="w-full bg-gray-800 rounded-md border-gray-700 text-white px-2 py-1" id="city" type="text">
</div>
<div class="flex-1">
<label class="text-white" for="state">State</label>
<input placeholder="Your state" class="w-full bg-gray-800 rounded-md border-gray-700 text-white px-2 py-1" id="state" type="text">
</div>
</div>
<div class="mt-4 flex flex-row space-x-2">
<div class="flex-1">
<label class="text-white" for="zip">ZIP</label>
<input placeholder="Your ZIP code" class="w-full bg-gray-800 rounded-md border-gray-700 text-white px-2 py-1" id="zip" type="text">
</div>
<div class="flex flex-row space-x-2">
<div class="flex-1">
<label class="text-white" for="country">Country</label>
<select class="w-full bg-gray-800 rounded-md border-gray-700 text-white px-2 py-1" id="country">
<option value="">Select a country</option>
<optgroup label="Africa">
<option value="AF">Afghanistan</option>
<option value="DZ">Algeria</option>
<option value="AO">Angola</option>
...
<option value="ZW">Zimbabwe</option>
</optgroup>
<optgroup label="Asia">
<option value="AM">Armenia</option>
<option value="AZ">Azerbaijan</option>
<option value="BH">Bahrain</option>
...
<option value="YE">Yemen</option>
</optgroup>
<optgroup label="South America">
<option value="AR">Argentina</option>
<option value="BO">Bolivia</option>
<option value="BR">Brazil</option>
...
<option value="VE">Venezuela</option>
</optgroup>
...
</select>
</div>
</div>
</div>
<div class="mt-4 flex justify-end">
<button class="bg-white text-black rounded-md px-4 py-1 hover:bg-blue-500 hover:text-white transition-all duration-200" type="submit">Submit</button>
</div>
</div>
کد CSS
.mt-4 {
margin-top: 1rem
}
.flex {
display: flex
}
.w-full {
width: 100%
}
.flex-1 {
flex: 1 1 0%
}
.flex-row {
flex-direction: row
}
.flex-col {
flex-direction: column
}
.justify-end {
justify-content: flex-end
}
.space-x-2 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(0.5rem * var(--tw-space-x-reverse));
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))
}
.rounded-lg {
border-radius: 0.5rem
}
.rounded-md {
border-radius: 0.375rem
}
.border-gray-700 {
--tw-border-opacity: 1;
border-color: rgb(55 65 81 / var(--tw-border-opacity))
}
.bg-gray-800 {
--tw-bg-opacity: 1;
background-color: rgb(31 41 55 / var(--tw-bg-opacity))
}
.bg-gray-900 {
--tw-bg-opacity: 1;
background-color: rgb(17 24 39 / var(--tw-bg-opacity))
}
.bg-white {
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity))
}
.p-4 {
padding: 1rem
}
.px-2 {
padding-left: 0.5rem;
padding-right: 0.5rem
}
.px-4 {
padding-left: 1rem;
padding-right: 1rem
}
.py-1 {
padding-top: 0.25rem;
padding-bottom: 0.25rem
}
.text-lg {
font-size: 1.125rem;
line-height: 1.75rem
}
.font-bold {
font-weight: 700
}
.text-black {
--tw-text-opacity: 1;
color: rgb(0 0 0 / var(--tw-text-opacity))
}
.text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity))
}
.shadow-sm {
--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
}
.transition-all {
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms
}
.duration-200 {
transition-duration: 200ms
}
.hover\:bg-blue-500:hover {
--tw-bg-opacity: 1;
background-color: rgb(59 130 246 / var(--tw-bg-opacity))
}
.hover\:text-white:hover {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity))
}