What is the best way to place a p-growl element in the bottom right corner of the page?

I've been struggling to fix the positioning of my growl message at the bottom right corner by overriding the CSS classes of p-growl. Initially, I attempted to override the .ui-growl class like this:

::ng-deep .ui-growl {   
    position: fixed;
    bottom: 0;
    right: 0;
    border: 3px solid #73AD21;
}

(The border was just for testing purposes.) However, this caused the growcontainer to stretch from top to bottom and stick to the bottom right, but the actual message inside still appeared at the top. So, in my second attempt, I applied the CSS rules directly to the message element using .ui-growl-item.

While this did make the growl message stick to the bottom right as desired, it also seemed to overwrite other default styles within .ui-growl-item, making the growl nearly invisible instead of its usual green or red color.

I've attached an image highlighting the issue with a pink arrow pointing to the affected growl. All you can see are faint white letters and part of the error cross symbol while the background remains visible.

Does anyone have any suggestions on how I could implement the necessary CSS rules for the growl without interfering with existing styles that I do not want to alter? I found the default file here , but I'm unsure which specific default CSS rules are crucial to maintain the color variations for different message types (error, success, etc.).

UPDATE:

I experimented with using top and left as alternatives to achieve the same positioning, but it proved impractical because larger messages risked extending off-screen while smaller ones failed to stay at the bottom consistently.

Answer №1

To make a simple adjustment, just modify the top attribute in the .ui-growl class.

Initially, the class looks like this:

.ui-growl {
    top: 100px;
}

You can change it to this or introduce a new style:

.ui-growl {
    top: 80vh !important;
}

Feel free to adjust the top position according to your needs. The vh unit refers to Viewport Height, calculated as a percentage of the total viewport height.

UPDATE: Here is an alternative style override suggestion:

.ui-growl {
    top: auto;
    bottom: 0px;
}

I hope this information proves useful. :)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using CSS to create various h1 headings with distinct colors and sizes

I am currently working with CSS and HTML, trying to replicate the design shown in this image: https://i.stack.imgur.com/Uyczp.png Initially, I attempted to achieve this by using multiple h1 tags, but after researching further, I realized that it is gener ...

Tips for enabling selection of list items in an input tag

Below is the code I have written to create an InputFilter. MyFilter = function(args) { var dataUrl = args.url; var divID = args.divID; var div = document.getElementById(divID); var myTable = '<input type="text" id="myInput" on ...

Dynamic forms in Angular do not currently have validation support for forms with multiple parts

I am currently working on creating a dynamic form with multi-part answers using Angular's Dynamic Form example (https://angular.io/guide/dynamic-form) and live example (https://angular.io/generated/live-examples/dynamic-form/eplnkr.html). I have set u ...

Using Bootstrap 3 to implement various grid systems within a single website

For a current project I am working on, my goal is to fill the entire .container with 7 columns within my grid system. To achieve this, I plan on adjusting the Less variable (@grid-columns) before compiling a bootstrap.css file at http://getbootstrap.com/cu ...

Creating an Angular Form Array with Radio Buttons

Having difficulties with implementing reactive forms and an array of radio buttons. Here is a glimpse at my form structure: https://i.sstatic.net/C7t2c.png Each row contains player details and I need to select the status for each player. Component sn ...

Using JSON data to populate the jQuery UI Datepicker

Is it possible to populate this jQuery UI datepicker calendar with data from a JSON file containing all non-working days for the years 2017 and 2018? P.S. return [!(month == 8 && day == 27), 'highlight', highlight]; - This example demons ...

After reinstallation, Angular CLI is still not functioning properly

I recently tried to upgrade my Angular CLI by uninstalling it and installing the new version. However, I encountered an issue where I am unable to run ng commands anymore due to an error message that keeps appearing: ng : File C:\Users\Sirius&bso ...

Combining the background images of two separate <div> elements results in a deeper shadow effect than when they are individually displayed

Encountering an issue with overlapping background images that results in a darker shadow where they intersect, causing an uneven appearance. The problem arises with a flexible height box containing semi-transparent background images designed to create att ...

Ngrx/effects will be triggered once all actions have been completed

I've implemented an effect that performs actions by iterating through an array: @Effect() changeId$ = this.actions$.pipe( ofType(ActionTypes.ChangeId), withLatestFrom(this.store.select(fromReducers.getAliasesNames)), switchMap(([action, aliases ...

Error Handling in Angular Reactive Forms for Array Type Form Controls

I'm currently working on an Angular project that involves creating a reactive form with fields using FormArray. While I am able to detect and display the error status as "INVALID" for dynamic fields, I'm facing challenges in handling errors for c ...

Is it possible that the div's height is not being set to 0 pixels

<div style="height:0px;max-height:0px"> </div> It appears that setting the height of a div to 0 pixels is not having the desired effect. The div is still expanding to display its contents, so how can we stop this from occurring? ...

Shadow border added to each div creates a unique navigation tab for easy access

#container { position: fixed; height: 100%; left: 0px; right: 0px; top: 0px; width: 10%; background-color: blue; } #container>div {} <html> <div id="container"> <div>up</div> <div>down</div> <d ...

Struggling to implement CSS variables across different browsers

I'm struggling to make CSS variables function properly, here is what I have so far: :root { --primary-color: #ffcd600; --spacing: 10px; --blur: 10px; } img { padding: var(--spacing); background: var(--primary-color); } When I check the el ...

Attempting to showcase information on the Angular frontend

When attempting to retrieve the Street name, I am seeing [object Object]. What is the optimal approach for displaying JSON data on the client side? I managed to display a street name but struggled with other components. How can I access the other elements ...

Arranging blocks within blocks? Placing additional text underneath a block

Looking to append some text at the end of a block called .label. Inside this block, there is a sub-element called .label_title, and below that is a picture/link enclosed in another block. Under the picture/link, I wish to include a short description while ...

Enhancing jQuery Mobile listview with voting buttons on each item row

I am looking to incorporate 2 vote buttons within a jQuery mobile listview, positioned on the left-hand side and centered within each list item. While I have managed to achieve this using javascript, my goal is to accomplish it without any additional scrip ...

The specified function 'isFakeTouchstartFromScreenReader' could not be located within the '@angular/cdk/a11y' library

I encountered the following errors unexpectedly while working on my Angular 11 project: Error: ./node_modules/@angular/material/fesm2015/core.js 1091:45-77 "export 'isFakeTouchstartFromScreenReader' was not found in '@angular/cdk/a11y&a ...

How to target child <div> elements within a parent <div> using jQuery

I am facing an issue with my parent <div> named #amwcontentwrapper. It contains a series of child divs with their own classes and ids. My goal is to utilize jQuery to select these child divs, and if they have the class .amwhidden, I want to leave th ...

What is the best way to send information using an array of objects?

In my Angular 5 project, I am using the ngx select dropdown package (https://www.npmjs.com/package/ngx-select-dropdown) and I'm wondering how to pass an array of objects instead of an array of strings. Currently, when I do so, it displays [Object Obje ...

A div element with the class name "draggable" is

One of my functions sends notifications to a page by prepending a main div with the notification. Here is the function: function displayNotification(notificationTitle, notificationContent, notificationColor, notificationSize) { console.log('Attem ...