Mercurial > libervia-web
comparison doc/web_framework/css_framework.rst @ 1134:28789926852a
doc: Libervia web framework quick_start + css_framework, first drafts
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 03 Oct 2018 21:01:42 +0200 |
parents | |
children | 4648a333b33f |
comparison
equal
deleted
inserted
replaced
1133:122dd136d1ab | 1134:28789926852a |
---|---|
1 Libervia CSS Framework | |
2 ====================== | |
3 | |
4 | |
5 Libervia come with generic CSS styling which is thought to be re-usable. If you create a new theme/site, you don't have to use it and can use something totally different, but building on top of Libervia CSS make theming more easy and consistent as you can re-use existant components without changing the classes. | |
6 | |
7 Bases | |
8 ----- | |
9 All CSS files must be in the ``static`` directory of your theme. Following names are assumed to be in this directory. | |
10 | |
11 Libervia may link one to several style sheets when it renders a template. It will always links the following file (if they exist): | |
12 - ``fonts.css`` (fonts loading) | |
13 - ``styles.css`` (main CSS style, see below) | |
14 - ``styles_extra`` (customizations of main style) | |
15 | |
16 Then it will link styles relative to the current theme (where path is joined with a ``_``). For instance, if your template is ``blog/article.html``, the following files will be linked (in this order, and if they exists): | |
17 - ``blog.css`` | |
18 - ``blog_article.css`` | |
19 | |
20 You can suffix any style sheet (but ``fonts.css``) with ``_noscript``: this suffixed file will be loaded only when javascript is not available, allowing to adapt your template to such case. | |
21 | |
22 The main CSS styling is ``styles.css``, it contains styles for every major elements used in Libervia. | |
23 CSS in Libervia follows ``BEM`` (Block Element Modifier) conventions. | |
24 | |
25 If you create a new theme, you should not touch ``styles.css``, but work on ``styles_extra.css`` instead. The later doesn't exist in default Libervia theme on purpose. | |
26 | |
27 There are a few "magic" classes, which imply some DOM modification when Javascript is enabled, see below. | |
28 Last but not least, there is also a "state system", i.e. classes which are dynamically changed during runtime. | |
29 | |
30 Magic Classes | |
31 ------------- | |
32 Magic classes are classes which imply a modification of DOM when the page is loaded and Javascript is activated. | |
33 The modification is done by a script launched by ``base/base.html``. | |
34 There are only a few of them: | |
35 | |
36 box--expand | |
37 When this class is applied, the box will be folded when is higher than 250px, and 2 "expand zone" (buttons) | |
38 will be added on top and bottom of the box to expand/reduce it. | |
39 | |
40 state_init | |
41 This is linked to state system (see below). When applied, the element will keep the ``state_init`` class until | |
42 clicked for the first time, then it will apply other magic classes effects if suitable. | |
43 | |
44 State System | |
45 ------------ | |
46 A basic state system is used to do some dynamic operation (like (un)folding a box). The two main states are: | |
47 | |
48 state_init | |
49 This class is present until first clicked | |
50 | |
51 state_clicked | |
52 This state is used with some magic classes (e.g. ``box-expand``) or when a clicking method from ``common.js`` | |
53 is used on an element (e.g. ``clicked_cls``). The classes is toggled on each click. | |
54 | |
55 Some classes are used to manipulate elements according to state: | |
56 | |
57 show_if_init | |
58 Display this class only if in ``state_init``. | |
59 | |
60 show_if_parent_clicked | |
61 display this class only if **parent** is in ``state_clicked`` | |
62 | |
63 show_if_parent_not_clicked | |
64 display this class only if **parent** is **not** in ``state_clicked`` | |
65 | |
66 show_if_grandparent_clicked | |
67 display this class only if **grandparent** is in ``state_clicked`` | |
68 | |
69 show_if_grandparent_not_clicked | |
70 display this class only if **grandparent** is **not** in ``state_clicked`` |