r/csshelp • u/[deleted] • Feb 19 '16
How do I make an interactive banner?
I see /r/LosAngelesRams and I want to create something like that for my subreddit. Any ideas how? For /r/STLSports
7
Upvotes
r/csshelp • u/[deleted] • Feb 19 '16
I see /r/LosAngelesRams and I want to create something like that for my subreddit. Any ideas how? For /r/STLSports
4
u/gavin19 Feb 20 '16
There are plenty of ways to go about it but they use spritesheets, like this.
The gist is that they make a list of links in the sidebar, assign each of them a portion of the spritesheet as the background image, and position them in the header. Each link has a fixed height applied so it only shows the top portion of the image (number). When they're hovered, the height is increased so all of the image is revealed.
I've made a version of it here. I've used different markdown so it doesn't show in the sidebar for those with styles disabled. It's an h5 (
#####), followed by a series of empty linksThe links are just dummies, but you can use any.
The CSS they use is
but all we need is
and it does the same job. The rams image referenced is their own spritesheet that I uploaded to that test sub.
Note - when you change a link in the sidebar, like
in place of one of the others, like
you need to change that matching reference in the CSS. So
would become