Tips for adjusting text sizes at different breakpoints in Quasar

I encountered an issue while attempting to customize font size and line height for each variable in quasar.variables.scss. Here is the error message that was displayed:

[plugin:vite:css] Undefined operation ""(600px,) > 0".
     ╷
6831 │   $noProcNotZero: $size > 0
     │                   ^^^^^^^^^
     ╵
  node_modules/quasar/dist/quasar.sass 6831:19  fg()
  node_modules/quasar/dist/quasar.sass 6971:3   root stylesheet

The snippet of my style sheet looks like this:

// Your custom Quasar SCSS (& Sass) Variables
// --------------------------------------------------
// You have the ability to override the default Sass/SCSS variables 
// found in Quasar's source files in order to give your app a unique look.

// Visit the documentation for a full list of Quasar variables

// Both your declared variables and Quasar's will be accessible in your .vue/.scss/.sass files

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@600&display=swap');

$primary: #da282f;
$secondary: hsl(0, 100%, 95%);
//$accent: #b927d3;
$primary-dark: #1b0000;
$background-accent: #f5f5f5;

$accent: #a0a0a0;
$background-accent: #f5f5f5;

$dark: #1d1d1d;
$dark-page: #121212;

$positive: #21ba45;
$negative: #c10015;
$info: #31ccec;
$warning: #f2c037;

$typography-font-family-secondary: 'Quicksand', sans-serif !default;

// Set maximum width for different screen sizes
$breakpoint-xs: 599px !default;
$breakpoint-sm: 1023px !default;
$breakpoint-md: 1439px !default;
$breakpoint-lg: 1919px !default;

$sizes: (
  'xs': 0,
  'sm': (
    $breakpoint-xs + 1,
  ),
  'md': (
    $breakpoint-sm + 1,
  ),
  'lg': (
    $breakpoint-md + 1,
  ),
  'xl': (
    $breakpoint-lg + 1,
  ),
) !default;

$breakpoint-xs-max: (map-get($sizes, 'sm') - 0.02) !default;

$breakpoint-sm-min: map-get($sizes, 'sm') !default;
$breakpoint-sm-max: (map-get($sizes, 'md') - 0.02) !default;

$breakpoint-md-min: map-get($sizes, 'md') !default;
$breakpoint-md-max: (map-get($sizes, 'lg') - 0.02) !default;

$breakpoint-lg-min: map-get($sizes, 'lg') !default;
$breakpoint-lg-max: (map-get($sizes, 'xl') - 0.02) !default;

$breakpoint-xl-min: map-get($sizes, 'xl') !default;

// Define fonts and sizes for headings and text
$h1: (
  size: 5rem,
  line-height: 6rem,
  letter-spacing: -0.01562em,
  weight: 300,
) !default;
$h2: (
  size: 3.75rem,
  line-height: 3.75rem,
  letter-spacing: -0.00833em,
  weight: 300,
) !default;
...
// Media queries to adjust font sizes based on screen width
@media (max-width: $breakpoint-xs-max) {
  .text-h1 {
    font-size: 2.5rem;
    line-height: 2.5rem;
  }
  ...
}
@media (min-width: $breakpoint-sm-min) and (max-width: $breakpoint-sm-max) {
  .text-h1 {
    font-size: 3.5rem;
    line-height: 3.5rem;
  }
  ...
}

Is it not possible to modify breakpoint fonts in this manner? If not, what would be the best approach to achieve the desired effect of having headers resize as the screen size changes?

Answer №1

My solution is effective for me. Consider updating your $sizes variable to:

$sizes: (
  "xs": 0,
  "sm": $breakpoint-xs + 1,
  "md": $breakpoint-sm + 1,
  "lg": $breakpoint-md + 1,
  "xl": $breakpoint-lg + 1,
);

The Quasar website uses Sass instead of Scss for their variables. It appears that there are some unnecessary parentheses in your code.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Can the font size of a container be adjusted proportionally to its width or height using only CSS?

When it comes to ensuring that the font always fits nicely within its container, I rely on using Javascript to set divs or specific class to have their font-size dynamically equal to their width, and adjust their inner text elements accordingly. If you wa ...

Don't display div if database has certain value - Angular

Is there a way to determine if a specific value exists in a PostgreSQL database? If so, can I then hide an HTML element based on this information? Can CSS and JavaScript be used to hide elements, or is there another method that should be utilized for hidi ...

Tips for customizing the appearance of a child component using the parent component in Vue.js

I am working on creating a layout using Vuejs and flexbox that includes elements like 'header, sidebar, main-content, sidebar, footer'. I have separated each part of the layout into individual .vue files, such as header.vue and sidebar.vue. In ...

Hide jQuery dropdown when mouse moves away

I am working on designing a navigation bar with dropdown functionality. Is there a way to hide the dropdown menu when the mouse pointer leaves both the navbar menu and the dropdown itself? I have tried using hover, mouseenter, and mouseleave but due to my ...

Enhancing appearance with $refs?

Having trouble adding style to the $refs attribute. I keep getting an error message saying "Cannot set property 'cssText' of undefined." Is there a way to accomplish this task? I haven't come across anything similar to this issue before. th ...

Using Vue.js in your application, you can implement a custom solution that mimics the

Embarking on a new project with VueJS/typescript as the frontend framework and currently utilizing vuex-persist to store data in localstorage. As I plan for this app to eventually become a mobile application, I am considering using NativeScript + VueJS. H ...

Moving responsive table cell to a new line

Currently, I am faced with the challenge of embedding third-party content via dynamic means without any knowledge of Ajax or jQuery. My question is whether it's feasible to move a table cell onto a new line, essentially creating a new row. The embedd ...

Can a border-bottom be made the same size as a class it is not linked to in CSS?

Can I set a border-bottom to match the size of a separate class? For example, I want a border-bottom at the bottom of each <section> tag. However, since the sections span the full width of the screen, the border-bottom inherits that width. Each < ...

What is the best way to reduce a varying percentage as the value continues to rise?

My memory of math may be a bit fuzzy, but I can't seem to recall how to solve this particular issue. In jQuery, I have been adding randomized clipping paths to my images using the following code: var max=100; var spread=5; jQuery.each( $("img"), func ...

Tips for showcasing timestamps within a Vue.js/Firebase application

In my current project, I am working on developing a chat application using Vue.js and Firebase. The codebase I am referring to can be found at https://github.com/jsfanatik/vuestacks-chat-vue-firebase. I have successfully implemented the Chat component to a ...

Ways to minimize the space between elements in a flex container

My goal is to minimize the space between my images that expand on hover. I aim for it to resemble this: expectation However, the current appearance is more like this: reality This is what I currently have: .container { display: flex; width: 100 ...

Switching icon when clicking on a Vue button

Is it possible to update the icon upon clicking a button in vue? Check out this code snippet: <v-btn flat icon color="white"> <v-icon>star_border</v-icon> </v-btn> Appreciate any guidance on this matter. ...

Exploring the process of defining a default route in NUXTJS

Looking for ways to personalize the routing in NUXT. I'm currently using the default page routing system in NUXT, but I want to set example.vue as the main landing page instead of index.vue. Additionally, I need to implement authentication on these ro ...

How to Insert a Background Image into Advanced Custom Fields (ACF) using CSS

Hey there, I'm facing a bit of a challenge with this particular section. In the past, I've only included ACF PHP within HTML when the background image was directly in the HTML code. Now, however, I have two shapes specified in my CSS using pseudo ...

CSS hover effect not working while mouse is in motion

As a beginner in HTML, CSS, jQuery, and JavaScript, I've been trying to trigger a div when hovering over one area using the adjacent siblings code. However, I'm encountering an issue where if I move my mouse after triggering the event, it keeps r ...

[ElectronJS][VueJs] ERROR_OSSL_EVP_UNSUPPORTED

I am in the process of developing an Electron app with VueJs. Currently, I am following a tutorial available at : https://www.youtube.com/watch?v=LnRCX074VfA However, I have encountered a bug and I am unsure about its meaning... Here is the error message ...

CSS - Discovering the reason behind the movement of text post generation (animation)

I have a question regarding CSS animation, specifically the typewriting effect. I was able to successfully achieve the typewriting effect using animation. However, I noticed that even though I did not set any animation for transforming, once the text is g ...

I am interested in designing a navigation bar with varying background and hover colors for each individual block

I need help creating a navigation bar with different background colors and hover colors for each block. I can do this separately but not together, so please advise on how to combine both in the li class. Below is the code for the navigation bar: header ...

What's the best way to position a lone CTA at the center of the second row on a two-column layout using Elementor?

On my page, I am facing a challenge of adding a second section with a single Call to Action (CTA). The previous section on the same page consists of two CTAs placed side by side with a width set at 50% each. However, now I need to add a third CTA without i ...

Troubleshooting Problem with Flexbox and Expandable/Accordion Side Menu

I currently have a wrapper class that contains an expandable side menu and main content section positioned side by side. The side menu acts as a filter for the content displayed in the main area, but I am encountering an issue where the rows separate when ...