如何将压缩图像包含在背景幻灯片中?

时间:2017-05-25 18:12:34

标签: css compression

您好刚刚推出了我的网站www.groupwrites.com,我得到的反馈主要是兼容性/移动问题。跑一个PageSpeedInsights并得到一些提示。我缩小了登陆CSS并更新了它。但它也说我应该压缩我的图像,我做了并将压缩的图像下载到我的电脑上。我不知道如何链接到这些。我的登陆CSS如下:

h1 {
  font-size: 5em;
  font-weight: bold;
  letter-spacing: 1px
}

hr {
  width: 600px;
  border-top: 1px solid #f8f8f8;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

body {
  background-color: #000;
  color: white;
  font-family: amatic sc;
}

h2 {
  font-weight: 600;
  letter-spacing: 1px;
  word-spacing: 4px;
  font-size: 3em;
}

a {
  color: white;
}

a:hover {
  color: rgb(100, 149, 237);
}

#landing-header {
  z-index: 1;
  position: relative;
  text-align: center;
  padding-top: 20%;
}

.slideshow {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.slideshow li {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-size: cover;
  background-position: 50% 50%;
  background-repeat: no-repeat;
  opacity: 0;
  z-index: 0;
  animation: imageAnimation 20s linear infinite;
}

.slideshow li:nth-child(1) {
  background-image: url(https://static.pexels.com/photos/269810/pexels-photo-269810.jpeg)
}

.slideshow li:nth-child(2) {
  background-image: url(https://static.pexels.com/photos/10651/photo-1432821596592-e2c18b78144f.jpeg);
  animation-delay: 5s;
}

.slideshow li:nth-child(3) {
  background-image: url(https://static.pexels.com/photos/64774/pexels-photo-64774.jpeg);
  animation-delay: 10s;
}

.slideshow li:nth-child(4) {
  background-image: url(https://static.pexels.com/photos/2318/vintage-technology-keyboard-old.jpg);
  animation-delay: 15s;
}

@keyframes imageAnimation {
  0% {
    opacity: 0;
    animation-timing-function: ease-in;
  }
  10% {
    opacity: 1;
    animation-timing-function: ease-out;
  }
  20% {
    opacity: 1
  }
  30% {
    opacity: 0
  }
}

.no-cssanimations .slideshow li {
  opacity: 1;
}

我在计算机上压缩了图像2,3和4的版本。例如,在位置:C:\Users\Nick\Downloads\optimized_contents\image。无法弄清楚如何链接到他们,而不是url()我尝试<img src=" " >等。

0 个答案:

没有答案