Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a grid (like graph paper grid) with just css?

Tags:

html

css

How to make a grid (like graph paper grid) with just CSS? I just want to make a virtual grid paper only using CSS.

like image 496
Amir Rustamzadeh Avatar asked Aug 22 '10 04:08

Amir Rustamzadeh


People also ask

How do you make a dotted background in CSS?

HTML-CSS : Exercise-28 with Solution Use background-color to set a black background. Use background-image with two radial-gradient() values to create two dots. Use background-size to specify the pattern's size. Use background-position to appropriately place the two gradients.

How do I put a background image in CSS grid?

Set a fallback color, So if your background image is not accessible/url is wrong then the call back color will automatically display as the background. this is also good if browser doesn't support the background-image or url it will automatically assign the fallback color as background-color.

How do you change the grid color in CSS?

To do so go to the Style tab and scroll to the bottom of the survey preview to access the link to the HTML/CSS Editor. CSS code should be placed on the Custom CSS tab. Then, simply replace the #CCCCCC portion of the code with the hex code for the color you wish to use.


2 Answers

To make grids you can use CSS gradients, which work on all modern browsers (see Caniuse).

Use linear gradients to draw a lined grid:

body {    background-size: 40px 40px;    background-image:      linear-gradient(to right, grey 1px, transparent 1px),      linear-gradient(to bottom, grey 1px, transparent 1px);  }

Use a radial gradient to draw a grid with dotted corners:

body {    background-size: 40px 40px;    background-image: radial-gradient(circle, #000000 1px, rgba(0, 0, 0, 0) 1px);  }
like image 95
shunryu111 Avatar answered Sep 19 '22 23:09

shunryu111


body {      background:          linear-gradient(-90deg, rgba(0,0,0,.05) 1px, transparent 1px),          linear-gradient(rgba(0,0,0,.05) 1px, transparent 1px),           linear-gradient(-90deg, rgba(0, 0, 0, .04) 1px, transparent 1px),          linear-gradient(rgba(0,0,0,.04) 1px, transparent 1px),          linear-gradient(transparent 3px, #f2f2f2 3px, #f2f2f2 78px, transparent 78px),          linear-gradient(-90deg, #aaa 1px, transparent 1px),          linear-gradient(-90deg, transparent 3px, #f2f2f2 3px, #f2f2f2 78px, transparent 78px),          linear-gradient(#aaa 1px, transparent 1px),          #f2f2f2;      background-size:          4px 4px,          4px 4px,          80px 80px,          80px 80px,          80px 80px,          80px 80px,          80px 80px,          80px 80px;  }
like image 32
Mathew stephen Avatar answered Sep 17 '22 23:09

Mathew stephen