question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Style for Child elements

See original GitHub issue

Hi gmerabishvili,

I love angular-ng-autocomplete. Thanks for make it.

Is it possible to enable custom style for elements like “input”?.

I have been added custom css like:

.ng-autocomplete { width: 100%; }

And this is ok.

But when I tried to add this nothing happened:

.ng-autocomplete .autocomplete-container { box-shadow: none !important; }

Thanks.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
gmerabishvilicommented, Jan 16, 2020

Hi @enriqueavg , Thank you very much! Yes it is possible. You just need to use ::ng-deep. Here is the example:

.ng-autocomplete {
  ::ng-deep .autocomplete-container {
    box-shadow: none;
  }
}
5reactions
enriqueavgcommented, Dec 8, 2020

Hi,

something.component.css looks like this:

`.ng-autocomplete { width: 100%; }

.ng-autocomplete ::ng-deep .autocomplete-container { box-shadow: none; }

.ng-autocomplete ::ng-deep .autocomplete-container ::ng-deep .input-container ::ng-deep input { font-size: 0.875rem; display: block; height: 2.1875rem; padding: 0.375rem 1rem; font-weight: 400; line-height: 1.52857143; color: #495057; border: 1px solid #dde6e9; border-radius: 0.25rem; }

.ng-autocomplete ::ng-deep .autocomplete-container ::ng-deep .suggestions-container ::ng-deep .item ::ng-deep .row { padding: 0.5rem 1rem; }

.ng-autocomplete ::ng-deep .autocomplete-container ::ng-deep .not-found { border: 0; }`

And something.component.html:

` <div class="ng-autocomplete">

        <!-- START ng-autocomplete component -->
        <!-- <ng-autocomplete [data]="data" [searchKeyword]="keyword" [initialValue]="value" (selected)='selectEvent($event)' (inputChanged)='onChangeSearch($event)' (inputFocused)='onFocused($event)' [itemTemplate]="itemTemplate" #auto minQueryLength="2" debounceTime="300"
            [notFoundTemplate]="notFoundTemplate">
        </ng-autocomplete> -->
        <!-- END ng-autocomplete component -->

        <!-- START template -->
        <ng-template #itemTemplate let-item>
            <div class="row">
                <div class="col-8">
                    <span [innerHTML]="item.name"></span>
                </div>
            </div>
        </ng-template>
        <!-- END template -->

        <!-- START template NOT FOUND -->
        <ng-template #notFoundTemplate let-notFound>

        </ng-template>
        <!-- END template NOT FOUND -->

    </div>
    <!-- END ng-autocomplete class -->
</div>
<!-- END col-12 -->

`

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apply CSS Style to child elements - Stack Overflow
Show activity on this post. I want to apply styles only to the table inside the DIV with a particular class: Note: I'd...
Read more >
Child combinator - CSS: Cascading Style Sheets | MDN
The child combinator ( > ) is placed between two CSS selectors. It matches only those elements matched by the second selector that...
Read more >
How to apply style to parent if it has child with CSS?
How to apply style to parent if it has child with CSS?
Read more >
How to apply style to parent if it has a child with CSS
It's easy to apply style to a child element, but if you want to apply style to a parent class that already has...
Read more >
CSS Apply to All Children - Linux Hint
We have a child selector in CSS to selecet and apply style to all the children. The child selector is also known as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found