dotjay / hashgrid

A little tool that inserts a layout grid in web pages, allows you to hold it in place, and toggle between displaying it in the foreground or background.
https://dotjay.github.io/hashgrid/
Other
446 stars 46 forks source link

CSS Centered #8

Closed pakpenyo closed 12 years ago

pakpenyo commented 12 years ago

i have found margin-left: -490px; is not true center in my grid. Using Less Framework 4. So, i change the css

grid{

width: 992px; position: absolute; top: 0; left: 50%; margin-left: -496px; /* original -490 */ }

grid div.vert{

width: 68px; border: none; margin-right: 24px; background: rgba(136,170,221,.25); }

Try compare with Less Framework grid from http://javascriptgrid.org/ and http://arnaumarch.com/en/less-grid.html.

Thanks and sorry for my english.

dotjay commented 12 years ago

Hi there!

Your negative margin-left value should always be half of your grid's width. As you have changed the original width from 980px to 992px, the original 490px left margin will no longer be correct.

Hope that explains it.