DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:css_selector_namespace

CSS Selector Namespace

If you want to target specific namespaces with CSS, you can use a conf/userscript.js-trick as explained here:

/* add namespace for CSS-selection, https://github.com/dokuwiki/dokuwiki/issues/2531#issuecomment-679170765 */
jQuery( 'body' ).attr( 'data-page-namespace', JSINFO.namespace );

For example, if you want all pages in a namespace named public: to have a custom background image, you can use the following CSS-rule. Note that the background image background-namespace-public.jpg is located in the user configuration folder for the template with name my-template-name.

/* custom background for pages in namespace 'public:'*/
body[data-page-namespace="public"] {
   background: no-repeat top/cover url('conf/tpl/my-template-name/background-namespace-public.jpg');
}
tips/css_selector_namespace.txt · Last modified: 2023-02-28 23:24 by Aleksandr

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki