-
-
Notifications
You must be signed in to change notification settings - Fork 27
Overriding $body-font-family via SASS requires !important CSS override due to specificity #312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
what's the content of your can you try with this? @use 'vuetify/settings' with (
$body-font-family: 'Dubai', sans-serif
); |
|
In your file, construction @use 'vuetify/settings' with (
) is missing. Please try with the way it described in docs I suppose you are migrating from nuxt/vue 2. So in vuetify 3 new sass import system is used, no more |
Thanks that worked (used @forward) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Custom Font Override Issue in Vuetify 3 + Nuxt 3 Setup
When setting a custom
$body-font-family
using Vuetify 3 SASS variables within a Nuxt 3 project, the defaultfont-family: Roboto
applied by Vuetify's base styles often overrides the custom font due to CSS specificity.This requires adding a manual CSS override with
!important
targeting.v-application
(or similar selectors) to force the custom font, even when the SASS variable configuration seems correct.🐞 To Reproduce
1. Setup
vuetify-nuxt-module
.2. Define Custom Font
@font-face
rules for a custom font (e.g.,'Dubai'
) in a globally included CSS file:assets/css/fonts.css
fonts.css
innuxt.config.ts
via thecss
array.public/fonts
.3. Configure Vuetify SASS
assets/scss/settings.scss
4. Configure
nuxt.config.ts
settings.scss
is used as the Vuetify SASS variables file.5. Observe
✅ Expected Behavior
The custom font (
'Dubai'
) defined in$body-font-family
should be applied globally to Vuetify components and the application base, inheriting correctly without needing further overrides.❌ Actual Behavior
font-family
on many elements defaults to Roboto.app.vue
):🧪 Environment
📌 Additional Context
This suggests that while the SASS variable override mechanism works for configuring Vuetify’s SASS compilation, the resulting CSS rule for the custom font doesn’t have sufficient specificity to override the default
Roboto
font applied by Vuetify’s base stylesheet in all contexts.Using
!important
is a workaround, but less ideal than relying solely on the SASS variable.The text was updated successfully, but these errors were encountered: