1

I am using primeng tooltip to display tooltip. I want the text to fit the content without wrapping and dont want to set fixed width.

following style not working for me.

        <a
            *ngIf="option.url"
            id="main-nav-{{ option.id }}"
            class="main-option"
            (click)="customNavigate(option)"
            [pTooltip]="option.label"
        >
            <i class="fas fa-fw" [class]="option.icon"></i>
            <span>{{ option.label }}</span>
        </a>

.p-tooltip .p-tooltip-text {
    background: $dark;
    color: $light;
    line-height: 2.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: 0.4rem;
    vertical-align: middle;
    z-index: 999999997;
    max-width: 14rem;
    border: solid 1px red;
}

In the below first image, how to get 'Event Reporting' in single line? enter image description here

enter image description here

with white-space: nowrap enter image description here

Mukil Deepthi
  • 6,072
  • 13
  • 71
  • 156

2 Answers2

0

Adding following to the above style worked for me:

white-space: nowrap;
max-width: fit-content;
width: 100em;
Mukil Deepthi
  • 6,072
  • 13
  • 71
  • 156
0

Try this.

white-space: nowrap;
width: fit-content;
mahan
  • 12,366
  • 5
  • 48
  • 83