0

Lets say I have an image with the width and height of 1700 x 1129px. What is the best way to be able to repeat this image so that you cannot tell that it has been repeated. I have tried using repeat-y but it looks like its another graphic.

enter image description here

Cody Guldner
  • 2,888
  • 1
  • 25
  • 36
Jess McKenzie
  • 8,345
  • 27
  • 100
  • 170
  • 1
    How about `background-size: 100% 100%`? It will make the background cover the element completely. – Mr_Green Mar 29 '13 at 09:26

4 Answers4

1

There is nothing to do with css. Your image does not allow repeating. To repeat an image without bad effects your image has to have same start and end in the direction you want it to repeat.

Linus Caldwell
  • 10,908
  • 12
  • 46
  • 58
0

There's a quite simple trick: end your image sides in a static color (like black or dark brown in your example), center your background image and color fill your background

body { background: black url(image.png) no-repeat center top; }

0

You will have to make a seamless image, that means that the upper and lower edges as well as the left and right edges of the image match their opposite edge perfectly, so no angles and color transitions being visible. The css approach using background-repeat is totally fine.

That's often used in CG, mostly in the 3D world. There's plenty of tutorials around on making an image seamless, found one here.

Fabian Lauer
  • 511
  • 2
  • 12
0

Use background-size property.

If you have a background which you think can be disguised by repeating horizontally then do the following.

background-size: 50% 100%; background-repeat: repeat-x;

if you think the background can be disguised by repeating vertically then do the following:

background-size: 100% 50%; background-repeat: repeat-y;
Mr_Green
  • 40,727
  • 45
  • 159
  • 271