删除 CSS 选框中的白色 space

Remove white space in CSS marquee

我正在尝试在 Wordpress 中使用 CSS3 动画添加选取框效果,因为它不支持 <marquee> 标签。我想去掉每个循环之间的白色 space 。我尝试使用 nowrap 但它不起作用。

@keyframes marquee {
  0% {
    text-indent: 430px
  }
  100% {
    text-indent: -485px
  }
}

@-webkit-keyframes marquee {
  0% {
    text-indent: 430px
  }
  100% {
    text-indent: -485px
  }
}

.marquee {
  font-size: 50px;
  overflow: hidden;
  white-space: nowrap;
  animation: marquee 12s linear infinite;
  -webkit-animation: marquee 12s linear infinite;
}

.marquee:hover {
  -webkit-animation-play-state: paused;
  animation-play-state: paused;
}
<p class="marquee">
  <a href="#">
    SOON SOON SOON SOON SOON SOON SOON </a></p>

Link 这里:http://www.houseofbase.fr/preview/wordpress/comingsoon/

不知道我是否理解,但尝试使用 margin-left negative like:

.marquee a{ margin-left: -50%; }

使用text-indent 进行转换不是一个好主意。用这个代替你的动画:

@keyframes marquee {
0% {
transform: translateX(100vw);
 }
100% {
    transform: translateX(-100vw);
   }
}

@-webkit-keyframes marquee {
  0% {
    transform: translateX(100vw);
  }
100% {
    transform: translateX(-100vw);
  }
}

@keyframes marquee {
0% {
transform: translateX(100vw);
 }
100% {
    transform: translateX(-100vw);
   }
}

@-webkit-keyframes marquee {
  0% {
    transform: translateX(100vw);
  }
100% {
    transform: translateX(-100vw);
  }
}
.marquee {
  font-size: 50px;
  overflow: hidden;
  white-space: nowrap;
  animation: marquee 12s linear infinite;
  -webkit-animation: marquee 12s linear infinite;
}

.marquee:hover {
  -webkit-animation-play-state: paused;
  animation-play-state: paused;
}
<p class="marquee">
  <a href="#">
    SOON SOON SOON SOON SOON SOON SOON </a></p>

像这样做你想做的。

.marquee {
  width: 100%;
  height: 80px;
  margin: 0 auto;
  overflow: hidden;
  white-space: nowrap;
}
.marquee-content {
  display: inline-block;
  margin-top: 5px;
  animation: marquee 10s linear infinite;
}
.item-collection-1 {
  position: relative;
  left: 0%;
  animation: swap 10s linear infinite;
}
@keyframes swap {
  0%, 50% {
    left: 0%;
  }
  50.01%,
  100% {
    left: 100%;
  }
}
.marquee-content:hover {
  animation-play-state: paused
}
.item1 {
  display: inline-block;
  height: auto;
  width: 500px;
  background: cyan;
  vertical-align: top;
  margin-left: 15px;
}
.item2 {
  display: inline-block;
  height: auto;
  width: 500px;
  background: magenta;
  vertical-align: top;
  margin-left: 15px;
}
/* Transition */

@keyframes marquee {
  0% {
    transform: translateX(0)
  }
  100% {
    transform: translateX(-100%)
  }
}
<div class="marquee">
  <div class="marquee-content">
    <span class="item-collection-1">
    <span class="item1"><a href="http://www.google.com">soon soon soon soon soon soon soon soon soon soon soon soon soon soon</a></span>
    <span class="item1"><a href="http://www.google.com">soon soon soon soon soon soon soon soon soon soon soon soon soon soon</a></span>

    </span>
    <span class="item-collection-2">
    <span class="item2"><a href="http://www.google.com">soon soon soon soon soon soon soon soon soon soon soon soon soon soon</a></span>
    <span class="item2"><a href="http://www.google.com">soon soon soon soon soon soon soon soon soon soon soon soon soon soon</a></span>

    </span>
  </div>
  <div>

.marquee {
  width: 100%;
  height: 80px;
  margin: 0 auto;
  overflow: hidden;
  display: inline-grid;
}