DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

External CSS Style Files

Sort:
You are not authorized to post a reply.





Growing Member





    Hello, I see that under Pages --> Advanced --> Appearance: Page Stylesheet I can provide the relative path to my external CSS file and the system automatically adds the file versioning, which is great <link href="/css/cv_home.css?cdv=75">

    How do I add my own GLOBAL css files such as <link href="/Portals/0/portal.css?cdv=75">?

    I don't want to use the Settings --> Custom CSS because that will grow into one huge CSS file.

    I have the website open in VS 2022 and my Page-specific .css files are working as expected. I'm just trying to figure out the GLOBAL css files, which I want to use to split up my styles.

    Thank you!






    Veteran Member





      The only global files you'll find in DNN are ones that you shouldn't be touching, such as Default.css.  

      Also, you're correct that you should be avoiding the Portal.css whenever possible.  That's mainly meant as a last resort place to manage CSS fixes that you can't/won't put into the theme.  It's also the last stylesheet, so it's helpful to override things that a rogue module might be doing to your website.  

      I have good news for you, though...  

      If you're running DNN, you also have a theme installed and in use.  This is the place that you should be including and managing any global styles for the website.  However, what the file name is will only be known to you.  Often, it may be called skin.css, but it could be named anything. 

      You'll find the theme in one of the following locations:  

      • /Portals/_default/Skins/[themename] & /Portals/_default/Containers/[themename]
      • /Portals/[XX]/Skins/[themename] & /Portals/[XX]/Containers/[themename]

      [XX] == The PortalID of the site, usually starting at zero (0).

      I hope this helps!  😎 






      Veteran Member





        Oh, by the way... If you're looking to override the global styles in DNN, this is the place to do it as well. :)





        Growing Member





          hhhhmm ok now I'm a bit confused though... I am working with a paid Skin (see below) and changing its settings through its ThemePlugin GUI.

          I am also creating brand new HTML directly in DNN and custom C# Controllers (Extensions) in VS.

          How do I add my own global CSS and JS where DNN will automatically manage its versioning suffix (?cdv=75)? and, what about adding them WITHOUT the suffix (?cdv=75)?

          Thank you!






          Veteran Member





            There are many ways you can so this, but when you simply add a "skin.css" file to your theme root folder, DNN will automatically load it (you might have te restart DNN after adding it).
            When you want to load custom files (css or JS), you can use the built in Client Resource mamangement, which will add the version QS parameter for you:

            https://docs.dnncommunity...resources/index.html

            You can use this in both a Theme and a custom extension






            Veteran Member





              I'm not very familiar with that specific commercial theme, but the theme plugins like the one you mention usually have a way for you to work on the CSS.  If it's not obvious, I'd suggest sending them a support request.  

              However, commercial themes that try to be "everything to everyone" will by default have a bunch of bloat (because it has to).  This is likely the reason why you're trying to break things apart.  It will have better performance and perceived performance improvements by scanning tools.  

              Keeping that mind... you may not be able to fully do what you really want to do, except by getting a custom theme built that only contains the features you need.  

              You are not authorized to post a reply.

              These Forums are dedicated to the discussion of DNN Platform.

              For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

              1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
              2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
              3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
              4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
              5. No Flaming or Trolling.
              6. No Profanity, Racism, or Prejudice.
              7. Site Moderators have the final word on approving / removing a thread or post or comment.
              8. English language posting only, please.

              Would you like to help us?

              Awesome! Simply post in the forums using the link below and we'll get you started.

              Get Involved