Search code examples
htmlcssmarquee

How can I make my vertical css marquee repeat


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


Solution

  • /* 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