Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Repeating A background with arbitary offset in CSS

Tags:

html

css

Well, I am wondering if we can repeat a background with an arbitary offset in CSS ? From that i mean can we "Shift" a tile x and y pixel everytime its rendering it ? The uses cases could be mosiacs, patterns and a lot of stuff, Even isometric tiling can be achieved using so.

For example if i have a tile of 10px x 10px

Each time the tile is repeated i want to shift it 10px from top so what i will achieve is

[//]
    [//] 
        [//]
            [//]

So is there any existant solution or is Canvas just the way to go ( Do it in canvas and then use it as a background )

like image 223
ShrekOverflow Avatar asked Jun 19 '13 11:06

ShrekOverflow


People also ask

How do you put a background image via CSS which will be repeated vertically?

The background-repeat property in CSS is used to repeat the background image both horizontally and vertically. It also decides whether the background-image will be repeated or not. Background-repeat: This property is used to repeat the background image both horizontally and vertically.

What sets how a background image will be repeated?

The background-repeat CSS property sets how background images are repeated. A background image can be repeated along the horizontal and vertical axes, or not repeated at all.


1 Answers

As of CSS3, this can't be done using only CSS styling. Repeated patterns are periodic either in the x (horizontal) direction, y (vertical) direction, both directions simultaneously, or neither (single image).

Reference: http://www.w3.org/TR/css3-background/#backgrounds

like image 72
Marc Audet Avatar answered Sep 28 '22 11:09

Marc Audet