CSS: Creating textured backgrounds

前端 未结 4 1337
谎友^
谎友^ 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条回答
  •  南方客
    南方客 (楼主)
    2021-01-30 04:26

    You should try slicing the image if possible into a smaller piece which could be repeated. I have sliced that image to a 101x101px image.

    BG Tile

    CSS:

    body{
      background-image: url(SO_texture_bg.jpg);
      background-repeat:repeat;
    }
    

    But in some cases, we wouldn't be able to slice the image to a smaller one. In that case, I would use the whole image. But you could also use the CSS3 methods like what Mustafa Kamal had mentioned.

    Wish you good luck.

提交回复
热议问题