It's better when it's simple

User Tools

Site Tools



So, how can I customize my template's CSS?

When you write or customize a template, you should not need to add the <link> tag within your page's header. To add your own CSS to the page, you should look at the style.ini file within your template dir.

Usually, you should add a line like myVeryOwn.css = screen in the [stylesheets] section of the style.ini file.

Why do this? I could just add a tag in my HTML template, no?

Yes, you can. However, depending on where and how you put this line you may end up with problems. When you add your CSS through the ini file, Dokuwiki will take it and resolve for you the paths within your CSS, so you don't have to add manually the full paths in your CSS. Example, if you want to add a logo.gif that's in the template dir, just write url(logo.gif) and don't bother with another path.

Other benefits of that method are that CSS is compressed in order to make the loading of the page faster and you can also benefit from the Pattern Replacement feature.

I tried it, but it doesn't work?

  • The most common mistake is that you forgot to put <?php tpl_metaheaders(); ?> in the <header> section of your page. (MWM)
faq/css.txt · Last modified: 2022-03-25 03:14 by

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