Can't resize image using CSS

后端 未结 5 1395
萌比男神i
萌比男神i 2021-01-01 03:36

I\'ve tried every answer I could find on all the sites I could find, but still haven\'t been able to properly resize an image using CSS. I\'ve got it inside a div, and tried

5条回答
  •  [愿得一人]
    2021-01-01 04:10

    CSS-Tricks has the best solution for this that I could find

    html { 
      background: url(images/bg.jpg) no-repeat center center fixed; 
      -webkit-background-size: cover;
      -moz-background-size: cover;
      -o-background-size: cover;
      background-size: cover;
    }

    Link to CSS-Tricks for the source and original code: https://css-tricks.com/perfect-full-page-background-image/

提交回复
热议问题