CSS: Creating textured backgrounds

前端 未结 4 1440
谎友^
谎友^ 2021-01-30 03:51

I am currently struggling with setting an image background for my site that will load fast enough. I have used data url image and even optomized images but its taking to long wh

4条回答
  •  萌比男神i
    2021-01-30 04:46

    Use an image editor to cut out a portion of the background, then apply CSS's background-repeat property to make the small image fill the area where it is used.

    In some cases, background-repeat creates seams where the image repeats. A solution is to use an image editor as follows: starting with the background image, copy the image, flip (mirror, not rotate) the copy left-to-right, and paste it to the right edge of the original, overlapping 1 pixel. Crop to remove 1 pixel from the right edge of the combined image. Now repeat for the vertical: copy the combined image, flip the copy top-to-bottom, paste it to the bottom of the combined, overlapping one pixel. Crop to remove 1 pixel from the bottom. The resulting image should be seam-free.

提交回复
热议问题