0

I have a grid snap implemented, but I want to make light grey lines show up both horizontally and vertically. My reasoning for this is that I am making a Designing application which has a similar look and feel to Visual Studios' form designing aspect.

I have some globals so that way i know the pixel spacing. I just want to get it working with Javascript. The page can go infinitely in the X and Y directions, so i cannot have a static length. It needs to be dynamic.

It is coming along so far, but was unsure if there is a current way to implement this.

    <hr style ="position:absolute;" width = "1" size = "500" />  
    <hr style ="position:absolute;" width = "500" size = "1" />
Fallenreaper
  • 8,518
  • 10
  • 53
  • 107

2 Answers2

2

If you have modern browser, I like this way :

body{
  background-size:15px 15px;
  background-position: 0 -5px;
}
body:hover{
  background-image: -webkit-linear-gradient(top, #ffffff, #ffffff 98%, #000000 100%); 
}

hover, could be nice, I think you can add easily a second background and add more css prefix.

edit : better

html{
  background-size:200px 200px,200px 200px;
  background-position: 0 0,0 0;
  color:#7a7a7a;
}
html:hover{
  background-image: -webkit-linear-gradient(top, transparent, transparent 199px, #000000 200px),-webkit-linear-gradient(left, transparent, transparent 199px, #000000 200px); 
}
benoît
  • 1,445
  • 3
  • 13
  • 27
0

Can you implement a for() loop which would create a finite number (determined by window width, or whatever you want) of rules, that creates a new horizontal-rule element every so many pixels. You can use DHTML to specify the style characteristics of each horizontal-rule.

By the way, if your grids don't need to move try position:fixed.

Hope this helps!

Botz3000
  • 37,236
  • 8
  • 100
  • 125
zdebruine
  • 2,665
  • 5
  • 24
  • 47
  • I think it might help. Right now, i am working with just using an which is just repeated. If that doesnt work out, I am going to see if it is possible to implement this way. – Fallenreaper Jun 05 '12 at 18:38