简体   繁体   中英

Angular javascript Primeng growl won't wrap text to next line

In Angular/Javascript, I am trying to get the text in growl to wrap using primeng 4.0.1. Specifically, I'm putting a file path into the growl, and it's such a long file path that it doesn't fit on one line. I just want it to wrap to the next line, but it won't do that.

I have tried a number of things. First, I tried modifying the css. Second, I tried creating a div to hold the growl and creating a style class for that div, setting word-wrap to bread-word and overflow-wrap to break-word.

Originally, I had no css for the growl. The css I added (below) will change the color successfully, but it seems word-wrap and overflow-wrap do not work as they should.

/deep/.ui-growl-message {
    float: left;
    color: purple;
    word-wrap:break-word !important;
    overflow-wrap: break-word !important;

}

html looks like this:

<p-growl [(value)]="msgs" sticky="false"></p-growl>

Sorry if this is a novice question - I don't really do UI dev.

Symptom is attached for reference. 在此处输入图像描述

Got it. The key to making it work was also specifying the width like so:

/deep/.ui-growl-message {
    float: left;
    color: purple;
    word-wrap:break-word !important;
    overflow-wrap: break-word !important;
    width: 85%;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM