F
Filamentโ€ข2mo ago
explosiboo

๐Ÿ‘‹ Hello, community!

Iโ€™m facing an issue #โ“โ”Šhelp with Tailwind CSS in my project and could really use some help. ๐Ÿ™ ๐Ÿ” The Problem Some Tailwind classes like my-5 (vertical margins) and ml-5 (left margin) are not working as expected. However, classes like mb-5 (bottom margin) seem to work fine. ๐Ÿค” ๐Ÿ› ๏ธ Configuration Files
import defaultTheme from 'tailwindcss/defaultTheme';

/** @type {import('tailwindcss').Config} */
export default {
content: [
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
'./storage/framework/views/*.php',
'./vendor/filament/**/*.blade.php',
'./resources/**/*.blade.php',
'./resources/**/*.js',
'./resources/**/*.vue',
],
darkMode: 'class',
theme: {
extend: {
fontFamily: {
sans: ['Figtree', ...defaultTheme.fontFamily.sans],
},
},
},
};
import defaultTheme from 'tailwindcss/defaultTheme';

/** @type {import('tailwindcss').Config} */
export default {
content: [
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
'./storage/framework/views/*.php',
'./vendor/filament/**/*.blade.php',
'./resources/**/*.blade.php',
'./resources/**/*.js',
'./resources/**/*.vue',
],
darkMode: 'class',
theme: {
extend: {
fontFamily: {
sans: ['Figtree', ...defaultTheme.fontFamily.sans],
},
},
},
};
` Vite
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
],
});

postcss.config.js

export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
],
});

postcss.config.js

export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
`
Blade File (HTML)

<div class="container">
<div class="mt-10 mb-5 ml-5">
<label> Label </label>
<input type="text">
</div>
</div>
Blade File (HTML)

<div class="container">
<div class="mt-10 mb-5 ml-5">
<label> Label </label>
<input type="text">
</div>
</div>
` ๐Ÿš€ Additional Details โ€ข Iโ€™m using darkMode: 'class', and I can confirm that Tailwind is loading correctly because other classes work. โ€ข Iโ€™ve cleared my browser cache and recompiled assets using npm run dev, but the issue persists. โ“ Any ideas what could be wrong? Any advice or suggestions would be greatly appreciated. Thank you in advance! ๐Ÿ’ก
No description
5 Replies
Matthew
Matthewโ€ข2mo ago
this is because classes like my-5 are used by fialment and are already precompiled. Afaik you need a custom theme, and you need to put the directory of your resource (view) files in the content array If you are 100% sure you are doing everything right, try and change the style from the web (devtools), and see if you can create changes that way. Sometimes, classes are overwritten by other classes and it might seem that they are not compiled, but in fact they are just not shown Another way is to open the network tab and check the theme.css file by doing ctrl+f and your class name
explosiboo
explosibooOPโ€ข2mo ago
Hi Matthew, I just wanted to thank you so much for your help on Discord. When I checked the webtool, I realized that the class mt-5 doesnโ€™t exist, but mb-5 does. Iโ€™m still not sure why this happens, but the good news is that I found out that mt-4 works, and thatโ€™s enough for me to continue with the project! Thanks again for your support, and I hope you have a great day!
No description
Matthew
Matthewโ€ข2mo ago
Nice, but as I said, you need a custom theme.here
explosiboo
explosibooOPโ€ข2mo ago
Thank you very much, I will check it out now. OMG it's working i love you (L), You made me very happy
Matthew
Matthewโ€ข2mo ago
happy to help :)

Did you find this page helpful?