問合せフォームのサンプル
<section class="text-gray-600 body-font relative"> <div class="container px-5 py-24 mx-auto"> <div class="flex flex-col text-center w-full mb-12"> <h1 class="sm:text-3xl text-2xl font-medium title-font mb-4 text-gray-900">お問い合わせ</h1> <p class="lg:w-2/3 mx-auto leading-relaxed text-base">下記からお問い合わせください。 .</p> </div> <div class="lg:w-1/2 md:w-2/3 mx-auto"> <div class="flex flex-wrap -m-2"> <div class="p-2 w-1/2"> <div class="relative"> <label for="name" class="leading-7 text-sm text-gray-600">名前</label> <input type="text" id="name" name="name" class="w-full bg-gray-100 bg-opacity-50 rounded border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 text-base outline-none text-gray-700 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out"> </div> </div> <div class="p-2 w-1/2"> <div class="relative"> <label for="email" class="leading-7 text-sm text-gray-600">Email</label> <input type="email" id="email" name="email" class="w-full bg-gray-100 bg-opacity-50 rounded border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 text-base outline-none text-gray-700 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out"> </div> </div> <div class="p-2 w-full"> <div class="relative"> <label for="message" class="leading-7 text-sm text-gray-600">問合せ内容</label> <textarea id="message" name="message" class="w-full bg-gray-100 bg-opacity-50 rounded border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 h-32 text-base outline-none text-gray-700 py-1 px-3 resize-none leading-6 transition-colors duration-200 ease-in-out"></textarea> </div> </div> <div class="p-2 w-full"> <button class="flex mx-auto text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-none hover:bg-indigo-600 rounded text-lg">送信</button> </div> <div class="p-2 w-full pt-8 mt-8 border-t border-gray-200 text-center"> <span class="inline-flex"> <a class="text-gray-500"> <svg fill="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="w-5 h-5" viewBox="0 0 24 24"> <path d="M18 2h-3a5 5 0 00-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 011-1h3z"></path> </svg> </a> <a class="ml-4 text-gray-500"> <svg fill="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="w-5 h-5" viewBox="0 0 24 24"> <path d="M23 3a10.9 10.9 0 01-3.14 1.53 4.48 4.48 0 00-7.86 3v1A10.66 10.66 0 013 4s-4 9 5 13a11.64 11.64 0 01-7 2c9 5 20 0 20-11.5a4.5 4.5 0 00-.08-.83A7.72 7.72 0 0023 3z"></path> </svg> </a> <a class="ml-4 text-gray-500"> <svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="w-5 h-5" viewBox="0 0 24 24"> <rect width="20" height="20" x="2" y="2" rx="5" ry="5"></rect> <path d="M16 11.37A4 4 0 1112.63 8 4 4 0 0116 11.37zm1.5-4.87h.01"></path> </svg> </a> <a class="ml-4 text-gray-500"> <svg fill="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="w-5 h-5" viewBox="0 0 24 24"> <path d="M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z"></path> </svg> </a> </span> </div> </div> </div> </div> </section>
グラーデーション
- 要素の背景画像を制御するためのユーティリティ。
- 上下左右+斜め8方向にグラーデーションをつけることができる
- グラーデーションのスタートはfrom-色-数値
- グラーデーションの中間はvia-色-数値
- グラーデーションの終了はto-色-数値
https://tailwindcss.com/docs/background-image
<div class="w-full py-20 bg-gradient-to-r from-blue-300 to-blue-500"></div> <div class="w-full py-20 bg-gradient-to-tl from-purple-200 via-pink-500 to-red-800"></div>
トランジション(時間的変化)
- 色、透明度、影、transformの4つを利用できる
https://tailwindcss.com/docs/transition-property
<div class="mb-16 mt-16"> durationあり <button class="bg-blue-500 hover:bg-blue-300 transition duration-1000 text-white font-semibold py-2 px-8 rounded-md">送信ボタン</button> durationなし <button class="bg-blue-500 hover:bg-blue-300 text-white font-semibold py-2 px-8 rounded-md">送信ボタン</button> ease-in(ゆっくり開始) <button class="bg-blue-500 hover:bg-blue-300 transition duration-1000 ease-in text-white font-semibold py-2 px-8 rounded-md">送信ボタン</button> ease-out(ゆっくり終了) <button class="bg-blue-500 hover:bg-blue-300 transition duration-1000 ease-out text-white font-semibold py-2 px-8 rounded-md">送信ボタン</button> delayあり <button class="bg-blue-500 hover:bg-blue-300 transition delay-1000 text-white font-semibold py-2 px-8 rounded-md">送信ボタン</button> </div>