You can always create it in Photoshop by drawing the first part and then copying it to the whole width. The other question is of course, how do you intend to use this grid?
This is relevant when:
- you'll and if you'll define it in CSS using
background-image because in that case you don't have to copy the pattern at all; you'll just set it to repeat in both directions;
- saving this grid file; if you need it to be transparent but you don't want to do that using CSS, then you will save it as a PNG;
And one more suggestion. It's usually wiser to create a Npx x 10px images instead of Npx x 1px, because browsers will render it faster, and file size will be almost the same. At least with this kind of images.
Use marquee tool.
- select the first X pixels that you want in gray (or any other colour)
- choose your colour
- use Edit > Fill menu option to fill selected pixels
- select the whole repeatable pattern (if you want it to repeat) and press Ctrl+C
- press Ctrl+V to copy the same pixels on a new layer
- by holding down Ctrl key and using arrow keys you can move new layer's content. When you want to move by 10px at a time hold down both Ctrl+Shift
- select a different colour and use the same menu option again to colour this new layer with new colour. Don't forget to check that you want transparent pixels to stay transparent.
- Copy the same layer (check menu in layers tool window) and follow steps from step 6.