Coder Social home page Coder Social logo

css-grid-debug's Introduction

Grid Debug

Apply a typographical grid lines to the background of any page.

You may either include grid_debug.js on your page, or use it as a bookmarklet.

If you include it on your page, you may invoke it from the console:

drawDebugGrid(40,20);

This will draw major lines every 40px and minor lines every 20px;

Bookmarklet

Create a new bookmark, and replace its URL with the following lovely blob:

javascript:%20-function%20drawDebugGrid(major,minor){var%20canvas=document.createElement("canvas");canvas.width=1;canvas.height=major;var%20ctx=canvas.getContext('2d');ctx.translate(0,-0.5);ctx.lineWidth=1;ctx.setStrokeColor('#ccc');ctx.moveTo(0,major);ctx.lineTo(32,major);ctx.stroke();if(minor){for(var%20i=minor;i<major;i+=minor){ctx.setStrokeColor('#eee');ctx.moveTo(0,i);ctx.lineTo(32,i);ctx.stroke();}}%20var%20dataUrl=canvas.toDataURL("image/png");document.body.style.cssText+='background:%20url('+dataUrl+')%20repeat';}(40,20)

The default is a 40/20, you can customize the major/minor rythmn by changing the two parameters at the end, so "(40,20)" could become "(36,9)" for instance.

More Reading

These articles provide more information on typographic rhythm:

Enjoy!

css-grid-debug's People

Contributors

adamsanderson avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.