How can I make my vertical css marquee repeat

牧云@^-^@ 提交于 2021-01-29 14:28:34

问题


I'm trying to make a vertical marquee loop without any whitespace/gaps but I can't seem to make it repeat. I added aria-hidden="true" which worked on my horizontal marquee but doesn't seem to be the fix this time.

here is a code pen with the marquee: https://codepen.io/theomarusman/pen/oNbBgej

this is the white space i want to remove

Edit: the row and col tags are useless I'm using code from another marquee to make this one and there I used it in a row and col


回答1:


/* Please try this instead */

body {
	background-color: black;
}

.side-bar {
	top: 0;
	left: 0;
	height: 100%;
	color: white;
	writing-mode: vertical-rl;
	text-orientation: sideways-right;
}

.marquee p {
	overflow: hidden;
	white-space: nowrap;
	height: 100%;
}

.marquee span {
	animation: marquee 8s linear infinite;
	display: inline-flex;
	padding-right: 10px;
	font-size: 4rem;
}

@keyframes marquee {
	from {
		transform: translateY(-100%);
	}

	to {
		transform: translateY(0);
	}
}
    <div class="position-fixed side-bar">
      <div class="row marquee">
        <div class="col-12 bg-white">
          <p class="m-0 p-0 p-3">
            <span class="m-0 p-0 pb-4" aria-hidden="true">USE CODE "MLT"</span>
            <span class="m-0 p-0 pb-4" aria-hidden="true">USE CODE "MLT"</span>
            <span class="m-0 p-0" aria-hidden="true">USE CODE "MLT"</span>
          </p>
        </div>
      </div>
    </div>
.marquee {
  overflow: hidden;
  white-space: nowrap;
}

@keyframes marquee {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(100%);
  }
}

This code changes to the following.

.marquee p{
  overflow: hidden;
  white-space: nowrap;
  height:100%;
}

@keyframes marquee {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

Solved in codepen

https://codepen.io/Rayeesac/pen/OJMWMpm

More examples are

Horizontal marquee without white space and JS

Vertical marquee without white space and JS



来源:https://stackoverflow.com/questions/62454347/how-can-i-make-my-vertical-css-marquee-repeat

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!