web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Custom css and js does...
Power Pages
Answered

Custom css and js doesnt work

(0) ShareShare
ReportReport
Posted on by 125

Hi All

I have added a button and some custom css and js for it but it doesnt work 😞 
 new buttonnew button

and thats some custom css and js

NonWorkingCSSandJS.PNG

But neither css or js not applied, button doest get round border and blue background and nothing happens when I click the button

Any ideas why its not working?

Thanks

Categories:
I have the same question (0)
  • Squire4Hire Profile Picture
    125 on at

    Be aware that custom css will not take precedence over portalbasictheme.css - which is the css package selected in the Styling section of your site. In order to bypass this, you'll need to use the !important qualifier on any css identifiers that may be implemented by the theme.

     

    Squire4Hire_0-1677617179446.png

     

     

    If you want all buttons to have a border radius, I suggest you update the value in the theme settings.

     

    Squire4Hire_1-1677617250487.png

     

    As for the JavaScript, try moving it out of the Custom Javascript section for that page and into a <script></script> tag at the bottom of your HTML. It might be easier to debug there.

  • Fubar Profile Picture
    8,350 Super User 2025 Season 2 on at

    Make sure you have synced your portal and view/preview the site itself (after refreshing the web page)

     

    For JavaScript always put it in a jQuery document.ready block (otherwise the script can run before the object exists on the page, and then it does nothing).

     

     

     

    // A $( document ).ready() block.
    $( document ).ready(function() {
     console.log( "ready!" );
    });

     

     

     

     

    For CSS preview/view the site using the Browser Console/Debugger (F12) and inspect the DOM node in question to see if your CSS is being overwritten (will show as stuck through). You browser will also enforce CSS precedence (technically called 'specificity'), if the dom node has a style="..." that is overwriting yours about all you can do is use Javascript/JQuery to change it, if it is another CSS class and it is not marked important (or even if it is) then you can try being more specific eg. use id rather than class, or use the tag type and nested tags in your CSS class definition (I read a good article on the web with examples last week but can't find it  https://uxengineer.com/css-specificity-avoid-important-css/ ).  

  • Verified answer
    romankorchak2 Profile Picture
    125 on at

    I found that any custom javascript or css doesnt apply if it goes to Web Page->Advanced

    PPCustomJSCSS1.PNG

     but only applied if added to Web Page -> Content -> Advanced


    PPCustomJSCSS2.PNG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 70 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 55

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard