meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| wiki:dokuwiki-css-doc [24/08/2021 22:19] – créée 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> | + | ===== Using IDs ===== |
| - | ===== Stylesheet Modes ===== | + | |
| - | There are five types of stylesheet modes: | + | When you use custom IDs in your template for assigning styles, be sure that the ID does not conflict with an existing ID. In particular, be sure that it won’t conflict with the IDs automatically assigned to section headers. The easiest way to ensure this is to use two adjacent underscores (%%__%%) in your ID. Because section IDs are always valid [[:pagenames]], |
| - | * **screen**: This is used when displaying pages in the web browser | + | In plugins use '' |
| - | * **print**: Definitions here will be used for printing pages | + | |
| - | * **all**: Applied in all display modes | + | |
| - | * <del>**rtl**: Definitions in '' | + | |
| - | * **feed**: Applied when displaying the [[: | + | |
| - | ==== RTL styles | + | ===== Styling based on page properties ===== |
| - | The RTL mode has [[devel: | + | 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 '' |
| - | <code css> | + | |
| - | .someClass { | + | |
| - | float: left; | + | |
| - | background-color: | + | |
| - | } | + | |
| - | [dir=rtl] .someClass { | + | |
| - | float: right; | + | |
| - | } | + | |
| - | </code> | + | |
| + | This offers quite a lot of possibilities. you can create a style for | ||
| - | ===== DokuWiki Stylesheets ===== | + | * this page only<code css conf/userstyle.css.snippet> |
| - | + | div.dokuwiki.pg_wiki_syntax { | |
| - | [[: | + | |
| - | + | h1 { | |
| - | + | | |
| - | ==== 1. Base Stylesheets ==== | + | } |
| - | + | }</code> | |
| - | These stylesheets are located within ''/ | + | * any page viewed |
| - | + | div.dokuwiki.loggedin.lv_1.mode_show { | |
| - | ==== 2. Plugins Styles ==== | + | |
| - | + | | |
| - | Plugins may define their own style definitions using the following files: | + | text-transform: uppercase; |
| - | + | } | |
| - | ^ Mode ^ CSS File ^ | + | |
| - | | screen | + | |
| - | | print | '' | + | |
| - | | all | '' | + | |
| - | | <del> | + | |
| - | | 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 | + | |
| - | + | ||
| - | ^ CSS File ^ When it is used ^ | + | |
| - | | '' | + | |
| - | | '' | + | |
| - | | <del>'' | + | |
| - | | '' | + | |
| - | | '' | + | |
| - | + | ||
| - | (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 { | + | |
| - | | + | |
| } | } | ||
| - | |||
| </ | </ | ||
| - | ===== Using IDs ===== | ||
| - | When you use custom IDs in your template for assigning styles, be sure that the ID does not conflict with an existing ID. In particular, be sure that it won’t conflict with the IDs automatically assigned to section headers. The easiest way to ensure this is to use two adjacent underscores (%%__%%) in your ID. Because section IDs are always valid [[: | ||
| - | In plugins | + | If your particular template does not use the [[xref>tpl_classes()]] function, you will have different classes available. In fhis case, you may want to contact the developer of your theme and ask that the template makes use of this function. |
| - | ===== Using images and importing styles ===== | + | Enough examples, here are the details : |
| - | Relative links to images ('' | ||
| - | An example: In a plugin, you want to use an image in the sub directory | + | * '' |
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * page '' | ||
| + | * page '' | ||
| + | * class '' | ||
| + | * class '' | ||
| + | * class '' | ||
| + | * page '' | ||
| + | * class '' | ||
| + | * class '' | ||
| + | * '' | ||
| + | * page '' | ||
| + | * page '' | ||
| + | * page '' | ||
| + | * '' | ||
| + | * page '' | ||
| + | * page '' | ||
| + | * page '' | ||
| + | * '' | ||
| + | * page '' | ||
| + | * page '' | ||
| + | * page '' | ||
| - | <code css> | + | ==== example selectors ==== |
| - | .someclass { | + | |
| - | | + | |
| - | } | + | |
| - | </ | + | |
| - | DokuWiki will automatically change the URL, so that the image will be found in the plugin directory, relative to the template directory. | + | To target all start page in any namespace use this |
| + | div.dokuwiki.pg_start | ||
| - | **Notes**: | + | To target |
| - | * '' | + | |
| - | | + | |
| - | ===== Caching ===== | + | To target a page exactly in the fr namespace |
| + | div.dokuwiki.ns__fr.lv_1 | ||
| - | All CSS files are fetched through | + | To target |
| + | div.dokuwiki.ns__fr | ||
| - | If you are making changes, ensure that you refresh | + | To target "this page does not yet exist" in any namespace when using the [[template: |
| + | div:not(.loggedIn).dokuwiki.notFound.mode_show.tpl_boozurk | ||
| - | ===== Browser (Internet Explorer) Specific CSS ===== | + | ==== A note for non english page and namespace |
| - | DokuWiki does not provide features to address browser specific | + | CSS accepts [[all non ascii codepoints above U+0080 |
| - | 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. '' | ||