mirror of https://github.com/zulip/zulip.git
docs: Provide an example of dynamic styling.
This commit is contained in:
parent
ee7b6f476d
commit
04656bf16f
|
@ -45,8 +45,20 @@ to avoid such a fate. So please make an effort to reuse existing
|
||||||
styling, clean up now-unused CSS, etc., to keep things maintainable.
|
styling, clean up now-unused CSS, etc., to keep things maintainable.
|
||||||
|
|
||||||
Opt to write CSS in CSS files. Avoid using the `style=` attribute in
|
Opt to write CSS in CSS files. Avoid using the `style=` attribute in
|
||||||
HTML unless the styling is actually dynamic. Instead, define logical
|
HTML except for styles that are set dynamically. For example, we set
|
||||||
classes and put your styles in external CSS files such as `zulip.css`.
|
the colors for specific streams (`{{stream_color}}`) on different
|
||||||
|
elements dynamically, in files like `user_stream_list_item.hbs`:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<span
|
||||||
|
class="stream-privacy-original-color-{{stream_id}} stream-privacy filter-icon"
|
||||||
|
style="color: {{stream_color}}">
|
||||||
|
```
|
||||||
|
|
||||||
|
But for most other cases, its preferable to define logical classes and
|
||||||
|
put your styles in external CSS files such as `zulip.css` or a more
|
||||||
|
specific CSS file, if one exists. See the contents of the `web/styles/`
|
||||||
|
directory.
|
||||||
|
|
||||||
### Be consistent with existing similar UI
|
### Be consistent with existing similar UI
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue