how I can determine if the div have an overflow hidden using html?

208 Views Asked by At

How can I determine if div has overflow hidden using html ? using Ngif I don't want to use it in type script code I need to set another attribute if the div has overflow hidden .

<div id="greetings" [innerHTML]="page.title">
</div>

#greetings{
   width: 100 px;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
}

How can I do that?

1

There are 1 best solutions below

3
Abel Valdez On

Exist a way to get the style information about of element by using a var inside of element in this case is named #vars it has the ability to get the style directly in the element that's why I put the atribute style="overflow: hidden"

Take a look to the following example:

<div id="greetings" style="overflow: hidden" #vars>
  <div *ngIf="(vars.style.overflow === 'hidden')">
      Hello universe!
  </div>
</div>

This is a demo