meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| wiki:dokuwiki-css-doc [25/08/2021 00:37] – [Styling based on page property] ztrulphcs | wiki:dokuwiki-css-doc [25/08/2021 07:21] (current) – ztrulphcs | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | Most of [[: | + | using css... bla bla bla |
| - | All CSS files are fetched through a single dispatcher in [[xref> | ||
| - | ===== Stylesheet Modes ===== | ||
| - | |||
| - | There are five types of stylesheet modes: | ||
| - | |||
| - | * **screen**: This is used when displaying pages in the web browser | ||
| - | * **print**: Definitions here will be used for printing pages | ||
| - | * **all**: Applied in all display modes | ||
| - | * < | ||
| - | * **feed**: Applied when displaying the [[: | ||
| - | |||
| - | ==== RTL styles ==== | ||
| - | |||
| - | The RTL mode has [[devel: | ||
| - | |||
| - | <code css> | ||
| - | .someClass { | ||
| - | float: left; | ||
| - | background-color: | ||
| - | } | ||
| - | [dir=rtl] .someClass { | ||
| - | float: right; | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | |||
| - | ===== DokuWiki Stylesheets ===== | ||
| - | |||
| - | [[: | ||
| - | |||
| - | |||
| - | ==== 1. Base Stylesheets ==== | ||
| - | |||
| - | These stylesheets are located within ''/ | ||
| - | |||
| - | ==== 2. Plugins Styles ==== | ||
| - | |||
| - | Plugins may define their own style definitions using the following files: | ||
| - | |||
| - | ^ Mode ^ CSS File ^ | ||
| - | | screen | ||
| - | | print | '' | ||
| - | | all | '' | ||
| - | | < | ||
| - | | feed | '' | ||
| - | |||
| - | Stylefiles with extension '' | ||
| - | |||
| - | To fit in well into any template' | ||
| - | |||
| - | :!: Stylesheets from plugins are loaded even if a plugin is not used (but not if a plugin is [[plugin: | ||
| - | |||
| - | :!: Styles defined here should take care of conflicts. So please be careful when writing a plugin. If possible add a prefix to your styles so that you're sure they won't conflict. | ||
| - | |||
| - | ==== 3. Templates Styles ==== | ||
| - | |||
| - | Template' | ||
| - | |||
| - | * Changes to '' | ||
| - | * See also: [[templates|Template Development]] | ||
| - | |||
| - | ==== 4. User Styles ==== | ||
| - | |||
| - | Additional styles, independently from the used template can be defined by the wiki administrator by creating the following CSS files in the wiki's configuration folder ('' | ||
| - | |||
| - | ^ CSS File ^ When it is used ^ | ||
| - | | '' | ||
| - | | '' | ||
| - | | < | ||
| - | | '' | ||
| - | | '' | ||
| - | |||
| - | (Note: the '' | ||
| - | |||
| - | These style files are useful to override small portions of template or plugin styles without running into problems on updating those later. | ||
| - | |||
| - | The following example reduces the bottom margin of the h2 and h3 headings when viewing in browser: | ||
| - | <code css userstyle.css> | ||
| - | h2, h3 { | ||
| - | margin-bottom: | ||
| - | } | ||
| - | |||
| - | </ | ||
| ===== Using IDs ===== | ===== Using IDs ===== | ||
| Line 92: | Line 9: | ||
| In plugins use ''< | In plugins use ''< | ||
| - | ===== Styling based on page property | + | ===== Styling based on page properties |
| - | Most often people only need to modify a style of some element on all pages. For example one may want to change the font style for h1 heading. But from time to time, it is desirable to modify a style only on certain page. You could want a special background for any page in the '' | + | Most often people only need to modify a style of some element on all pages. For example one may want to change the font style for h1 heading. But from time to time, it is desirable to modify a style only on certain page. You could want a special background for any page in the '' |
| <div id=" | <div id=" | ||
| Line 122: | Line 39: | ||
| - | * '' | ||
| * '' | * '' | ||
| - | * '' | ||
| * '' | * '' | ||
| - | * '' | + | |
| + | | ||
| * '' | * '' | ||
| * '' | * '' | ||
| + | * ''< | ||
| * '' | * '' | ||
| * '' | * '' | ||
| Line 143: | Line 60: | ||
| * page '' | * page '' | ||
| * page '' | * page '' | ||
| - | '' | + | * '' |
| - | * page '' | + | * page '' |
| + | * page '' | ||
| + | * page '' | ||
| + | * '' | ||
| + | * page '' | ||
| + | * page '' | ||
| + | * page '' | ||
| + | ==== example selectors ==== | ||
| - | ===== Using images and importing styles ===== | + | To target all start page in any namespace use this |
| + | div.dokuwiki.pg_start | ||
| - | Relative links to images ('' | + | To target the main page |
| + | div.dokuwiki.home | ||
| - | An example: In a plugin, you want to use an image in the sub directory '' | + | To target |
| + | div.dokuwiki.ns__fr.lv_1 | ||
| - | <code css> | + | To target a page anywhere in the fr namespace |
| - | .someclass { | + | |
| - | | + | |
| - | } | + | |
| - | </ | + | |
| - | DokuWiki will automatically change the URL, so that the image will be found in the plugin directory, relative to the template | + | To target "this page does not yet exist" |
| + | div: | ||
| - | **Notes**: | + | ==== A note for non english page and namespace ==== |
| - | * '' | + | |
| - | * '' | + | |
| - | ===== Caching ===== | + | CSS accepts [[all non ascii codepoints above U+0080 in class names. However, support for these CSS class name may vary from browser to browser. Note also that the page ID and namespace ID in dokuwiki depend on the [[config: |
| - | All CSS files are fetched through a single dispatcher in '' | ||
| - | |||
| - | If you are making changes, ensure that you refresh the cache of your browser by a //Hard reload/ | ||
| - | |||
| - | ===== Browser (Internet Explorer) Specific CSS ===== | ||
| - | |||
| - | DokuWiki does not provide features to address browser specific CSS rendering, therefore any standard approach can be used in your template files. | ||
| - | |||
| - | The [[https:// | ||
| - | |||
| - | This wrapper method inserts a specific CSS style ID around the entire content. Your template .css file (design.css, | ||
| - | |||
| - | <code css> | ||
| - | #IE8 # | ||
| - | ...css styles... | ||
| - | } | ||
| - | </ | ||
| - | You will need to edit the files in your template (ie. '' | ||