J'ai besoin d'intimité. Non pas parce que mes actions sont douteuses, mais parce que votre jugement et vos intentions le sont.
5138 links
Un très bon guide !
Via Timo.
Pour qui aime les articles qui apportent des informations indispensables de manière limpide, c'est beau comme du Verlaine !
Tout est dit !
Un site qui répertorie toutes les options possibles avec grid.
En complément de la vidéo de grafikart
Un mémento sur les grilles css
Tutoriel sur les grille par Mozilla
Tutoriels sur les grilles css et le debugger de Firefox
Rien que le nom, je suis fan.
La puissance de Flex-box est énorme :
Fukol™ is a lightweight, breakpoint free, completely responsive, element query driven*, progressive enhancement based CSS grid framework. It exists in this README.md
file, in the section titled The CSS (below). It is 93 bytes minified, fitting comfortably inside a tweet:
Just edit the lines marked 'edit me!' to your requirements and write an HTML structure like the one illustrated in the section titled The HTML (also below).
(* Not really, but kind of. See 3 under Notes, below.)
.fukol-grid {
display: flex; /* 1 */
flex-wrap: wrap; /* 2 */
margin: -0.5em; /* 5 (edit me!) */
}
.fukol-grid > * {
flex: 1 0 5em; /* 3 (edit me!) */
margin: 0.5em; /* 4 (edit me!) */
}
<div class="fukol"> <!-- 6 -->
<ul class="fukol-grid">
<li><!-- grid cell/item/child/whatever --></li>
<li><!-- grid cell/item/child/whatever --></li>
<li><!-- grid cell/item/child/whatever --></li>
<li><!-- grid cell/item/child/whatever --></li>
<li><!-- grid cell/item/child/whatever --></li>
<li><!-- grid cell/item/child/whatever --></li>
<li><!-- grid cell/item/child/whatever --></li>
<li><!-- grid cell/item/child/whatever --></li>
</ul>
</div>
display: flex
declaration, degrading to a single column layout. No harm done.wrap
value means items will start a new row if there's not enough room on the current one.5em
in the example — the flex basis) and make sure items can grow to use the available space (1
) but not shrink (0
). So only change the 5em
value and leave 1 0
as it is.0.5em
margin here means gutters of 1em
(the margins double up)..fukol-grid
container remains flush horizontally and no additional margin is added to the vertical flow.class="fukol"
container in the HTML snippet enables you to add positive margins around the grid — not possible with just .fukol-grid
because this uses negative margins (see 5). It also suppresses horizontal scrolling issues which occur under certain circumstances.Sometimes you want certain items to be narrower or wider. Maybe you want the fifth item to always be approximately twice the size of a regular item (where space permits). If the regular flex-basis
is 5em
, then…
.fukol-grid > *:nth-child(5) {
flex-basis: 10em;
}
Don't worry, flexbox will make sure there aren't any gaps.
You can choose a percentage based width for individual items, but remember to adjust for the gutter margin with by subtracting it using calc
. For example, to make the first item 100% in width when the gutter width is 1em
, use:
.fukol-grid > *:first-child {
flex-basis: calc(100% - 1em);
}
Warning: Internet Explorer does not respect box-sizing
on flex-basis
items. In which case, if you use percentage widths, you cannot pad the flex item directly. You will need to insert child nodes inside flex items and pad them instead.
<div class="fukol"> <!-- 6 -->
<ul class="fukol-grid">
<li>
<div><!-- pad this --></div>
</li>
</ul>
</div>
Flexbox supports rtl
already. Just add dir="rtl"
to the .fukol-grid
element and the flex direction will automatically be reversed.
README.md
file. See the The CSS section above.That's it.
Bigrement intéressant ! À lire et à mettre en pratique.
Flexbox est vraiment excellent comme fonctionnalité css.
Je viens de tester sur IE11 et ça fonctionne bien.
Adopté.