Skip to content
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

Not able to override styling on tags #60

Closed
shightower opened this issue Mar 12, 2018 · 4 comments
Closed

Not able to override styling on tags #60

shightower opened this issue Mar 12, 2018 · 4 comments

Comments

@shightower
Copy link

Version of Vue I'm using?: 2.5.2

Version of vue-input-tag I'm using?: 1.0.3

codesandbox showing the issue: https://codesandbox.io/s/ly4rr9379

I'm unable to override the default stylings for the actual tags. the following snippet works but (as expected) it only effects the surround div.

.vue-input-tag-wrapper {
background-color: red !important;
}

the moment I try following, all the defined overrides are ignored. In my use case I'm trying to get the tags to be a different color and I'd like the edges to be rounded. I have the css to do this, but it doesn't seem to pick up any of my changes.

.vue-input-tag-wrapper .input-tag {
background-color: red !important;
color: white !important;
}

@mdaliyan
Copy link
Contributor

Overriding styles are possible, this is the code I used before. mind the variables. you need to change them.

.vue-input-tag-wrapper {
  display: inline-flex !important;
  flex-wrap: wrap;
  height: auto;
  .new-tag {
    color: inherit !important;
    font-size: inherit !important;
    width: auto !important;
  }
  .input-tag {
    margin: 2px 4px 2px 0 !important;
    padding: 1px 6px !important;
    background-color: whitesmoke !important;
    border: 1px solid darken(whitesmoke, 15%) !important;
    color: $input-color !important;
    .remove {
      &:before {
        content: "\00d7" !important;
        vertical-align: text-bottom;
      }
      color: lighten($text-color,20%) !important;
      margin-left: 5px;
      &:hover {
        color: $danger !important;
      }
    }
  }
  .rtl & {
    .input-tag {
      margin: 2px 0 2px 4px !important;
      .remove {
        margin-left: 0;
        margin-right: 5px;
        float: left;
      }
    }
  }
}

@shightower
Copy link
Author

With the help of someone else I figured out the problem. I didn't realize this about Vue, but the issue was the fact I was trying to override the styles in a scoped styling block. Once I moved this to a none scope styling block everything worked fine.

@matiastucci
Copy link
Owner

Sorry I didn’t answer. I’m on vacations without my laptop. But I’m glad you could figure it out thanks to @mdaliyan.

@mdaliyan
Copy link
Contributor

mdaliyan commented Mar 18, 2018

I got the credit, lol

and @shightower, I prefer not to use styles in .vue files if I have a separated css file unless a special case comes up (eg. one time styles). It makes the development faster for me. Just saying.

Best practices change over time. See how you feel about your code and how easy you work with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants