No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Cannot style elements using CSS

    Framework
    3
    12
    4432
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      chiragiem36 last edited by

      I cannot style elements/template using CSS inside styles (<style></style>)
      Styling elements inside tag is working (<p style=“color: black” ), but now with CSS

      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        @chiragiem36 You are definitely doing a misuse somewhere. Can you post a reproduction repo so we can all take a look and help you? Thanks.

        1 Reply Last reply Reply Quote 0
        • N
          NoRabbit last edited by

          Have the same problem, quasar.mat.styl seems to be taken after the style set in Hello.vue (for ex.)
          see chrome css inspector: https://pasteboard.co/GQ8KuxG.png
          (I’m in dev, not prod)

          1 Reply Last reply Reply Quote 0
          • N
            NoRabbit last edited by

            just so this is complete:
            I set my class on a button component like this: <q-btn flat class=“main-toolbar-btn”>
            and at the bottom of my Hello.vue file:
            <style lang=“stylus”>
            .main-toolbar-btn
            width 70px
            border-left-width 1px
            height 98px
            border-left-color #dcdada
            border-left-style solid
            margin 0
            color #4d5154
            </style>

            1 Reply Last reply Reply Quote 0
            • N
              NoRabbit last edited by

              and putting the style in the app.mat.styl does the same
              basically, I’m trying to override the margin set in quasar.mat.styl at 2991:

              .q-btn
              margin 0 .2rem
              padding .2rem

              Maybe there is some basic css rules that just make it like so but having to put it in the style tag would be quite annoying as it would totally remove the advantage of using css.

              thx !

              1 Reply Last reply Reply Quote 0
              • N
                NoRabbit last edited by

                but if I override the exact same declaration found in quasar.mat.style (@2991) in my app.mat.styl like so:
                .q-toolbar

                .q-btn
                margin 0

                it works…
                So the best thing I can do is this:
                .q-toolbar

                .q-btn
                &.main-toolbar-btn
                width 70px
                border-left-width 1px
                height 98px
                border-left-color #dcdada
                border-left-style solid
                margin 0
                color #4d5154

                but this is kind of uncomfortable as I really need to specifically target classes…

                1 Reply Last reply Reply Quote 0
                • rstoenescu
                  rstoenescu Admin last edited by

                  Can you confirm you are using the latest default starter kit? Quasar’s CSS should always come first and then component’s CSS.

                  1 Reply Last reply Reply Quote 0
                  • N
                    NoRabbit last edited by

                    at the date I wrote it, yes I took the latest default starter kit (followed the instruction on the website and it was the very first time I used quasar)
                    can you point me where I should be looking to make the change ? some config file I guess or the hot reload module…
                    thx

                    1 Reply Last reply Reply Quote 0
                    • N
                      NoRabbit last edited by

                      if you can find a solution to this, it would be awesome because this is becoming a real deal breaker for me.
                      I don’t know if it has to do with the webpack vue template compiler because it seems that no one is willing to fix the issue… (on github)
                      and using scoped css creates more problems than it solves.

                      If I can be of any help, just tell me in wich files I should be looking into, I’ll try to understand this webpack horrible beast…

                      1 Reply Last reply Reply Quote 0
                      • N
                        NoRabbit last edited by

                        so to summarize, this has to do with how the css is imported into the html in dev mode (hope this is not doing it in prod as well)
                        quasar style comes after some of my components style.
                        It appears that the styles are ordered by name… so if I have “Program.vue” and “User.vue”, the styles from Program will come before Quasar styles and the styles from User will come after.

                        1 Reply Last reply Reply Quote 0
                        • N
                          NoRabbit last edited by

                          the name order might not be the case…

                          1 Reply Last reply Reply Quote 0
                          • N
                            NoRabbit last edited by

                            Allright, it’s solved, at least for me.
                            I was importing the quasar style in a component (bad idea, don’t know why I did that in the first place) as I saw it referenced twice in the head section of my page (doesn’t webpack check on double references ?)
                            Now everything is working fine.
                            Sorry for that

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post