CSS background image on top of

前端 未结 3 898
生来不讨喜
生来不讨喜 2020-12-01 14:50

How does one repeat this 1px x 1px CSS background image on top of the HTML ?

http://jsfiddle.net/hjv74tdw/1/

I came

3条回答
  •  攒了一身酷
    2020-12-01 15:28

    Here's what I did for my solution. Essentially, I'm using the "IMG" as a placeholder. So that my Background image maintains the correct proportions as the browser resizes.

    .image-overlay {
      background-image: url("insert image here");
      display: inline-block;
      position: relative;
      background-size: cover;
      background-repeat: no-repeat;
      background-position: center;
    }
    .image-overlay img {
      opacity: 0;
    }
    

    HTML

提交回复
热议问题