ng-multiselect-dropdown custom css

//Angular by default adds some _ngcontent-xx to your component CSS file
//so that it won't conflict with other components.
//To solve your problem you need to add below CSS in your global style.css file or
//another way to make your component as encapsulation: ViewEncapsulation.None meaning its CSS
//won't append default classes of Angular.

//Solution 1: Add in global stylesheet.
style.css
.multiselect-dropdown .dropdown-btn {
    display: inline-block;
    border: 1px solid #adadad;
    width: 100%;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.1;
    text-align: left;
    vertical-align: middle;
    cursor: pointer;
    background-image: none;
    border-radius: 4px;
}

//Solution 2 Make component ViewEncapsulation.None
component.ts
import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ],
  encapsulation: ViewEncapsulation.None // Add this line
})
export class AppComponent  {

}

5
1
Wanda 130 points

                                    // you can override css of any node module or library by :host and ::ng-deep.

:host ::ng-deep .multiselect-dropdown .dropdown-btn {
	display: inline-block;
	border: 1px solid #adadad;
	width: 100%;
	padding: 6px 12px;
	margin-bottom: 0;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.1;
	text-align: left;
	vertical-align: middle;
	cursor: pointer;
	background-image: none;
	border-radius: 4px;
}

5 (1 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source