Get a grid, at least vertically

February 17, 2016

Need a vertical grid in Chrome, Safari or Firefox? Disappointed by the half-assed plugins available?

Fear not, use this:


var m=15;
for(var i=1;i*m<document.body.offsetHeight;i+=1)
{
    var a=document.createElement('div');
    a.setAttribute(
        'style',
        'position:absolute;top:'
            +i
            +'rem;left:0;width:'
            +document.body.offsetWidth
            +'px;height:1px;background-color:#000;'
    );
    document.body.appendChild(a)
    if(i==1){
        m=a.getBoundingClientRect().top
    }
}    

Click this Link to get a grid, or right-click and save it as a bookmarklet for when you really need to go chasing that
elusive Vertical Rhythm.

Lines are conveniently spaced 1rem apart.

Get a Grid, at least vertically - February 17, 2016 - mw