Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
H
Hello Gargan
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • arturo
  • Hello Gargan
  • Wiki
    • 3—sass usage
  • 3.2—CSS integration model

3.2—CSS integration model

Last edited by arturo Nov 29, 2021
Page history

CSS model standard

  • Reserve CSS Gridbox stricly for two dimensional layout cases and non dynamic layouts

Why? As stated in this article by Per Harald Borgen, CSS Gridbox are layout-first. Meaning that the grid determines the items placement and position. Whereas CSS Flexbox are content-first, meaning that the items can decide how they are placed.

These guides made by the CSS-Tricks team are the most complete about CSS Flexbox and CSS Gridbox

  • Use the box model margin property only if you have mastered it

Why? margin use is prone to a phenomenom called margin collapse. Lack of knowledge on this particular subject leads to unwanted side effects. Please read these two articles from the MDN and Pineco teams for detailed explanations.

In a nutshell, we differenciate three skill levels:

  1. as noted by Chris Coyier, margin is best leave out
  2. as written by Harry Roberts, the ideal use is to restrict the margin to single-direction declarations
  3. as claimed by Hugo Giraudel, when fully mastered, margin makes layouting elements much less frustrating
  • Every elements are set to box-sizing: border-box

Why? Even if border-box is not the default box-sizing value, it feels more natural and is advocated for years by the community to be the CSS standard (eg. by Paul Irish from the Google Chrome core team, or Chris Coyier from the CSS-Tricks team).

  • Stick to the px unit for every standard lengths, instead of relative units (em, rem)

Why? Our minds are trained in pixels when it comes to user interfaces, relative units are counter-intuitive by essence. The thorough analyze of Gion Kunz in this article relates all the flaws with rem and em, and should only be used for few specific use cases.

Useful resources

  • Understanding CSS z-index how stacking elements (w/ or w/o z-index) and stacking contexts work

SASS guidelines

  • Our guidelines mostly follows the model proposed by Hugo Giraudel.

Why? At this day these SASS guidelines are the most structured and popular one. The opinionated key principles and convention picked out by the author, such as the BEM naming, are purely empirical and respect our own conceived ideas. Main difference here, is that we have strictly opposed a main and bootstrap folders. The reason is that Bootstrap (even the recent v5) is still not compliant with SASS Modules API (which will deprecates the old @import API in October 2022)

  • We also select the Eduardo Bouca's approach (from the CSS-Tricks team) for media queries specifications

Why? Even it complexifies a little bit media querie declarations, it provides a clear syntax capable of simply dealing with specific screen resolution (eg. "retina" or "x2" screens)

Useful resources

  • BEM 101 details explanation about the BEM naming convention
  • Battling BEM CSS 10 common problems and how to avoid them
  • Using Sass to control scope with BEM naming importance of $self operator
  • Incomplete List of Mistakes in the Design of CSS a list of infuriating details regarding CSS design decisions

« 3.1 — SASS files             4 — UI library »
Clone repository
  • 1—Application structure
  • 2—Components
    • 2.1—Component structure
    • 2.2—Page and Layout structure
    • 2.3—Store structure
  • 3—SASS-usage
    • 3.1—SASS files
    • 3.2—CSS integration model
  • 4—UI library
  • 5—Form validation
  • 6—Component Cookbook
  • 7—Miscellaneous
  • 8—Milestones
  • Home
More Pages

New Wiki Page

Tip: You can specify the full path for the new file. We will automatically create any missing directories.