=============================== Write lean easy-to-maintain CSS =============================== There are many ways to lean and simplify SCSS. The first step is to establish if custom code is needed at all. Odoo's webclient has been designed to be modular, meaning that (potentially all) classes can be shared across views. Check the code before creating a new class. Chances are that there is already a class or an HTML tag doing exactly what you're looking for. On top of that, Odoo relies on `Bootstrap `_ (BS), one of the most complete CSS frameworks available. The framework has been customized in order to match Odoo's design (both community and enterprise versions), meaning that you can use any BS class directly in Odoo and achieve a visual result that is consistent with our UI. .. warning:: - The fact that a class achieves the desired visual result doesn't necessarily mean that it's the right one for the job. Be aware of classes triggering JS behaviors, for example. - Be careful about class semantics. Applying a **button class** to a **title** is not only semantically wrong, it may also lead to migration issues and visual inconsistencies. The following sections describe tips to strip-down SCSS lines **when custom-code is the only way to go**. .. _tutorials/scss_tips/browser_defaults: Browser defaults ================ By default, each browser renders content using a *user agent stylesheet*. To overcome inconsistencies between browsers, some of these rules are overridden by `Bootstrap Reboot `_. At this stage all "browser-specific-decoration" rules have been stripped away, but a big chunk of rules defining basic layout information is maintained (or reinforced by *Reboot* for consistency reasons). You can rely on these rules. .. example:: Applying `display: block;` to a `
` is normally not necessary. .. code-block:: css div.element { display: block; /* not needed 99% of the time */ } .. example:: In this instance, you may opt to switching the HTML tag rather than adding a new CSS rule. .. code-block:: css span.element { display: block; /* replace with
instead to get 'display: block' by default */ } Here's a non-comprehensive list of default rules: .. list-table:: :header-rows: 1 * - Tag / Attribute - Defaults * - `
`, `
`, `
`, `