tools = require('../js/tools'); tools.init()purpose¶
create grid-based layouts, obviously
gridis now available in all popular modern browsers
ex1 - proportional columns¶
next snippet demontrates:
a proportional grid of [3 rows ⨉ 4 columns]
with 4 areas defined, based on that tiling
header,main,sidebar, andfooterand 4
<div>s that are mapped on these areas e.g.grid-area: header
all this in one property:

ex2 - partially fixed columns¶
mostly the same, but :
we can specify fixed size for some columns
only change is to replace
grid-template-columns: 1fr 1fr 1fr 1frwithgrid-template-columns: 100px 1fr 5% 1fr;
and now
the first column has a fixed size
the third column has a size proportional to the page width
and columns 2 and 4 equally share whatever is left in width
ex3 - on rows too¶
in the previous examples :
we have not imposed anything on the height of the result
each box gets its height based on its content
it is also possible - although less often needed
to fix a height globally and arrange the rows accordinglyonly change is to add on the grid:
height: 100vhto say we want to use all viewport heightgrid-template-rows: 50px 1fr 100px;
which specifies how to use vertical space
assignment: the css-tricks page¶
browse quickly - but entirely - the very good introduction to grids that can be found on css-tricks.com so as to get a good grip of what’s achievable
you may also complete this game https://
more vs-code tricks¶
insert a wrapping tag¶
when using these technologies, you are often in a position to add wrapping tags in your html
to do this easily under vs-code :
select the text you want to wrap
enter the palette - the swiss knife in vs-code
(mac: ⌘-⇧-p - Windows ⌃-⇧-p - in doubt, ask google)type
Emmet wrap with abbreviationenter the tag name
in pictures: if you need to add a wrapping <div> / </div> around some text, select it

then activate the palette and search for ‘emmet: wrap with abbreviation’

select that function, you will be prompted for the name of the wrapping tag

custom keybinding¶
it is rather straightforward to attach a custom keybinding to that function if you use it often
start with .. the palette, of course

for example here, we just type ‘Alt-o’ and the shortcut gets recorded from now on
