CSS for specific page

avatar
(anonymous user)

Is it possible to have a custom CSS for a page in dashboard.
If yes how can we achieve that.

All Comments (10)

avatar

CSS stylesheets are added at the Dashboard/App level.

The only other way I can think of is to use New-UDHelmet to add a stylesheet using the style tag, however, this depends on what you are trying to achieve.

What challenge are you looking to overcome? Are you looking to separate your stylesheets or, are you looking to override certain classes/ID’s?

avatar

I am trying to override a style for header in a specific page only

avatar

You could use UDHelmet to do this. Here’s an example using the dashboard content but you could do the same within a page.

New-UDApp -Title 'PowerShell Universal' -Content {
    New-UDHelmet -Tag 'style' -Content "
    header { 
        background-color: black !important;
        color: white !important;
    }
    "
}




030402346e6b09057838438da18f1ffe52081039

Adam Driscoll
PowerShell Expert and Developer at Devolutions

030402346e6b09057838438da18f1ffe52081039.png

avatar

I did that and got following error


751d11feb356b1ea748a45b5f59d2499a7b4f746

751d11feb356b1ea748a45b5f59d2499a7b4f746.png

avatar

What version of PSU are you running?

Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar

3.9.12

avatar

New-UDHelmet was added in 4.0.0. It’s not in the v3 branch of the universal-docs repo, so i don’t think it has been backported.

avatar

Also,
Is there a way to have a CSS applied to all the dashboards without actually going to each of them.

avatar

You can use Helmet from the gallery.

GitHub
There currently isn’t a way to apply CSS to all dashboards.

Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar

Thank you, Adam will follow the link and try to install helmet and see if that works.