Laravel8、認証はBreeze使用、TailwindCSSでフォームを作っています。
package.json▼
"@tailwindcss/forms": "^0.5.2", "alpinejs": "^3.4.2", "autoprefixer": "^10.4.2", "axios": "^0.21", "laravel-mix": "^6.0.6", "lodash": "^4.17.19", "postcss": "^8.4.6", "tailwindcss": "^3.1.0"
フォームのCSSは、こちらのTailblocksから持ってきました。
(CONTACTの3番目をコピペし、不必要なものを削除しました。)
が、一部のclassが反映されません。。。
例えば、
こちらのButtonには、px-8
をセットしていますが、paddingの左右は入っていないようです。
▼こちらコードです。 create.blade.php
<x-app-layout> <x-slot name="header"> <h2 class="font-semibold text-xl text-gray-800 leading-tight"> オーナー登録 </h2> </x-slot> <div class="py-12"> <div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg"> <div class="p-6 bg-white border-b border-gray-200"> <section class="text-gray-600 body-font relative"> <div class="container px-5 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> </div> <div class="lg:w-1/2 md:w-2/3 mx-auto"> <div class="m-2"> <div class="p-2 w-1/2 mx-auto"> <div class="relative"> <label for="name" class="leading-7 text-sm text-gray-600">Name</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 mx-auto"> <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 mt-4 w-1/2 mx-auto"> <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</button> </div> </div> </div> </div> </section> </div> </div> </div> </div> </x-app-layout>
buttonのclassを、px-8
ではなく、px-4
にするとこちらは反映されました。
なぜpx-8だとpaddingの左右がなくなってしまうのか、アドバイスいただけますと幸いです。
よろしくお願いいたします。
念のため、app.blade.phpも記載します。
<!DOCTYPE html> <html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="csrf-token" content="{{ csrf_token() }}"> <title>{{ config('app.name', 'Laravel') }}</title> <!-- Fonts --> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap"> <!-- Styles --> <link rel="stylesheet" href="{{ mix('css/app.css') }}"> <!-- Scripts --> <script src="{{ asset('js/app.js') }}" defer></script> </head> <body class="font-sans antialiased"> <div class="min-h-screen bg-gray-100"> @if(auth('admin')->user()) @include('layouts.admin-navigation') @elseif(auth('owners')->user()) @include('layouts.owner-navigation') @elseif(auth('users')->user()) @include('layouts.user-navigation') @endif <!-- Page Heading --> <header class="bg-white shadow"> <div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8"> {{ $header }} </div> </header> <!-- Page Content --> <main> {{ $slot }} </main> </div> </body> </html>
【追記】
paddingだけではなく、background-colorのclassbg-gray-200
も反映されません。
ボタンを2つ並べ、左の「戻る」ボタンをグレーにしたいのですが、色がつきません。
<button class="bg-gray-200 border-0 py-2 px-4 focus:outline-none hover:bg-gray-400 rounded text-lg">戻る</button> <button class="text-white bg-indigo-500 border-0 py-2 px-4 focus:outline-none hover:bg-indigo-600 rounded text-lg">登録する</button>
background-color: transparent;
がかかってまして、こちらを無効にすると、戻るボタンに色が付きました!
・・・こちらは何か関係があるのでしょうか・・・
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。