Infinite-Scrolling Logos In Flat HTML And Pure CSS<\/h1>\nSilvestar Bistrovi\u0107<\/address>\n 2024-04-02T12:00:00+00:00
\n 2024-06-12T20:05:40+00:00
\n <\/header>\n
When I was asked to make an auto-scrolling logo farm, I had to ask myself: \u201cYou mean, like a <marquee><\/code>?\u201d It\u2019s not the weirdest request, but the thought of a <marquee><\/code> conjures up the \u201cold\u201d web days when Geocities ruled. What was next, a repeating sparkling unicorn GIF background?<\/p>\nIf you\u2019re tempted to reach for the <marquee><\/code> element, don\u2019t. MDN has a stern warning about it right at the top of the page<\/a>:<\/p>\n\u201cDeprecated:<\/strong> This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible [\u2026] Be aware that this feature may cease to work at any time.\u201d<\/p><\/blockquote>\nThat\u2019s fine because whatever infinite scrolling feature <marquee><\/code> is offered, we can most certainly pull off in CSS. But when I researched examples to help guide me, I was surprised to find very little on it. Maybe auto-scrolling elements aren\u2019t the rage these days. Perhaps the sheer nature of auto-scrolling behavior is enough of an accessibility red flag to scare us off.<\/p>\nWhatever the case, we have the tools to do this, and I wanted to share how I went about it. This is one of those things that can be done in lots of different ways, leveraging lots of different CSS features. Even though I am not going to exhaustively explore all of them, I think it\u2019s neat to see someone else\u2019s thought process, and that\u2019s what you\u2019re going to get from me in this article.<\/p>\n
What We\u2019re Making<\/h2>\n
But first, here’s an example of the finished result:<\/p>\n\nSee the Pen [CSS only marquee without HTML duplication [forked]](https:\/\/codepen.io\/smashingmag\/pen\/YzMQMXe) by Silvestar Bistrovi\u0107<\/a>.<\/p>See the Pen CSS only marquee without HTML duplication [forked]<\/a> by Silvestar Bistrovi\u0107<\/a>.<\/figcaption><\/figure>\nThe idea is fairly straightforward. We want some sort of container, and in it, we want a series of images that infinitely scroll without end. In other words, as the last image slides in, we want the first image in the series to directly follow it in an infinite loop.<\/p>\n
So, here\u2019s the plan: We\u2019ll set up the HTML first, then pick at the container and make sure the images are correctly positioned in it before we move on to writing the CSS animation that pulls it all together.<\/strong><\/p>\n\n
\n 2024-06-12T20:05:40+00:00
\n <\/header>\n
<marquee><\/code>?\u201d It\u2019s not the weirdest request, but the thought of a <marquee><\/code> conjures up the \u201cold\u201d web days when Geocities ruled. What was next, a repeating sparkling unicorn GIF background?<\/p>\nIf you\u2019re tempted to reach for the <marquee><\/code> element, don\u2019t. MDN has a stern warning about it right at the top of the page<\/a>:<\/p>\n\u201cDeprecated:<\/strong> This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible [\u2026] Be aware that this feature may cease to work at any time.\u201d<\/p><\/blockquote>\nThat\u2019s fine because whatever infinite scrolling feature <marquee><\/code> is offered, we can most certainly pull off in CSS. But when I researched examples to help guide me, I was surprised to find very little on it. Maybe auto-scrolling elements aren\u2019t the rage these days. Perhaps the sheer nature of auto-scrolling behavior is enough of an accessibility red flag to scare us off.<\/p>\nWhatever the case, we have the tools to do this, and I wanted to share how I went about it. This is one of those things that can be done in lots of different ways, leveraging lots of different CSS features. Even though I am not going to exhaustively explore all of them, I think it\u2019s neat to see someone else\u2019s thought process, and that\u2019s what you\u2019re going to get from me in this article.<\/p>\n
What We\u2019re Making<\/h2>\n
But first, here’s an example of the finished result:<\/p>\n\nSee the Pen [CSS only marquee without HTML duplication [forked]](https:\/\/codepen.io\/smashingmag\/pen\/YzMQMXe) by Silvestar Bistrovi\u0107<\/a>.<\/p>See the Pen CSS only marquee without HTML duplication [forked]<\/a> by Silvestar Bistrovi\u0107<\/a>.<\/figcaption><\/figure>\nThe idea is fairly straightforward. We want some sort of container, and in it, we want a series of images that infinitely scroll without end. In other words, as the last image slides in, we want the first image in the series to directly follow it in an infinite loop.<\/p>\n
So, here\u2019s the plan: We\u2019ll set up the HTML first, then pick at the container and make sure the images are correctly positioned in it before we move on to writing the CSS animation that pulls it all together.<\/strong><\/p>\n\n