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

    Apply CSS inside q-input elements

    Help
    3
    5
    3213
    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.
    • N
      NikTang last edited by

      I have two q-input elements:

      <q-input class="login-input" v-model="username" stack-label="Username"  />
      <q-input class="login-input" v-model="password" type="password" stack-label="Password" />
      

      I managed to increase the font size of the label and input box by using scoped style:

      <style scoped>
      .login-input{
          font-size:1.5rem;
          line-height:1.5rem;
      }
      </style>
      

      I also want to increase the gap between the label and the text box, so I added this

      .login-input input{
          margin-top: 10px;
      }
      

      No matter what I put in the CSS attribute in this block, It seems not taking any effect. What’s the proper way to style the elements inside q-input?

      1 Reply Last reply Reply Quote 0
      • bestog
        bestog last edited by

        Have you ever tried “!important” after each css attribute? Same result?

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

          <style scoped>
          .login-input > div {
              padding-top: 20px;
          }
          </style>
          
          1 Reply Last reply Reply Quote 0
          • N
            NikTang @bestog last edited by NikTang

            @bestog @benoitranque Both suggestions do work. Actually in developer tool, when I look at all CSS attributes of the input element inside .login-input, my settings do not even appear in the list. Very weird. I got a feeling that the browser is not able to match those generated elements with my CSS properly.

            1 Reply Last reply Reply Quote 1
            • N
              NikTang last edited by

              Finally I managed to fix this by moving the settings from scoped style to global style.

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