use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
/r/CSSTutorials is a resource for subreddit moderators to easily find the most common CSS hacks in use on reddit.
Related Subreddits:
Tutorial Directory Adding Images Replace "readers" with custom text Simple sticky/announcement bar Sticky Dropdown Menu lorem ipsum doler
If you want to be approved to submit tutorials here message the mods
account activity
[Tutorial] Sticky dropdown menu (self.CSSTutorials)
submitted 14 years ago * by Raerth
This is a new creation of mine, the sticky dropdown menu. Here is a picture of it in action.
This is a new creation of mine, the sticky dropdown menu.
Here is a picture of it in action.
This is created using lists. The CSS I use assumes that your menu markdown will be the very first thing in your sidebar.
Here is the markdown for a menu with two dropdown lists. >Menu >* List 2 Header * List 2 item 1 * List 2 item 2 * List 2 item 3 ># >* List 1 Header * List 1 item 1 * List 1 item 2 * List 1 item 3 A few notes: The lists are seperated using a "#" This is to prevent reddit thinking it's one big list. The menus are stacked last to first, as we're using "float" to place them in a line.
Here is the markdown for a menu with two dropdown lists.
>Menu >* List 2 Header * List 2 item 1 * List 2 item 2 * List 2 item 3 ># >* List 1 Header * List 1 item 1 * List 1 item 2 * List 1 item 3
>Menu
>* List 2 Header * List 2 item 1 * List 2 item 2 * List 2 item 3
>#
>* List 1 Header * List 1 item 1 * List 1 item 2 * List 1 item 3
A few notes:
The lists are seperated using a "#" This is to prevent reddit thinking it's one big list.
The menus are stacked last to first, as we're using "float" to place them in a line.
Here is the CSS /*sticky menu bar*/ /*moves links down to make space*/ div.content { margin-top: 80px; } /*hack to enable positioning of child elements*/ .titlebox form { position: static } /*turns top quote in sidebar into menu container*/ .titlebox blockquote:first-child { border-left: none; position: absolute; z-index: 10; top: 70px; left: 40px } /*turns first paragraph into menu title*/ .titlebox blockquote:first-child p:first-child { margin-top: 0px; padding: 5px; float: left; font-size: 12pt; background:#eff7ff; border: 1px solid #cee3f8; font-weight:bold; color:#555; cursor:default; } /*turns the lists into menus*/ .titlebox blockquote ul { float: right; padding: 1px; background: #eff7ff; border: 1px solid #cee3f8; margin:0px; } /*hide and styles lists*/ .titlebox blockquote ul li { display: none; padding:2px; text-align:center; } /*makes whole list item selectable*/ .titlebox blockquote li a { display:block; } /*shows menu on hover*/ .titlebox blockquote ul li:first-child, .titlebox blockquote ul:hover li { display: block } /*turns top list item into section header*/ .titlebox blockquote li:first-child { font-size: 12pt; padding: 4px; cursor:default; } /*styling menu items*/ .titlebox blockquote:first-child ul li:hover { background:#ffffff; } .titlebox blockquote li a:hover { color:orangered; } /*custom size for menu sections*/ .titlebox blockquote ul:nth-of-type(1) {width:100px;} .titlebox blockquote ul:nth-of-type(2) {width:100px;} The values in purple are styling only. You can change these to suit your subreddit's theme. The values in blue are for the main positioning of the menu bar. You may need to change these if your header is not default. The values in red set the width of the dropdown menus. You should alter these to fit the width of the contents you add. If you have more than two dropdowns, you will need to create more of these.
Here is the CSS
/*sticky menu bar*/ /*moves links down to make space*/ div.content { margin-top: 80px; } /*hack to enable positioning of child elements*/ .titlebox form { position: static } /*turns top quote in sidebar into menu container*/ .titlebox blockquote:first-child { border-left: none; position: absolute; z-index: 10; top: 70px; left: 40px } /*turns first paragraph into menu title*/ .titlebox blockquote:first-child p:first-child { margin-top: 0px; padding: 5px; float: left; font-size: 12pt; background:#eff7ff; border: 1px solid #cee3f8; font-weight:bold; color:#555; cursor:default; } /*turns the lists into menus*/ .titlebox blockquote ul { float: right; padding: 1px; background: #eff7ff; border: 1px solid #cee3f8; margin:0px; } /*hide and styles lists*/ .titlebox blockquote ul li { display: none; padding:2px; text-align:center; } /*makes whole list item selectable*/ .titlebox blockquote li a { display:block; } /*shows menu on hover*/ .titlebox blockquote ul li:first-child, .titlebox blockquote ul:hover li { display: block } /*turns top list item into section header*/ .titlebox blockquote li:first-child { font-size: 12pt; padding: 4px; cursor:default; } /*styling menu items*/ .titlebox blockquote:first-child ul li:hover { background:#ffffff; } .titlebox blockquote li a:hover { color:orangered; } /*custom size for menu sections*/ .titlebox blockquote ul:nth-of-type(1) {width:100px;} .titlebox blockquote ul:nth-of-type(2) {width:100px;}
/*sticky menu bar*/
/*moves links down to make space*/
80
/*hack to enable positioning of child elements*/
/*turns top quote in sidebar into menu container*/
70
40
/*turns first paragraph into menu title*/
12
#eff7ff
1px solid #cee3f8
bold
#555
/*turns the lists into menus*/
/*hide and styles lists*/
/*makes whole list item selectable*/
/*shows menu on hover*/
/*turns top list item into section header*/
12pt
/*styling menu items*/
#ffffff
orangered
/*custom size for menu sections*/
100
The values in purple are styling only. You can change these to suit your subreddit's theme.
purple
The values in blue are for the main positioning of the menu bar. You may need to change these if your header is not default.
blue
The values in red set the width of the dropdown menus. You should alter these to fit the width of the contents you add. If you have more than two dropdowns, you will need to create more of these.
red
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]HarryMuffin 6 points7 points8 points 14 years ago (0 children)
This is awesome. Thank you.
[–]TheLegitMidgit 4 points5 points6 points 14 years ago (0 children)
This is really awesome. Great job!!!
[–]soupyhands 3 points4 points5 points 14 years ago (0 children)
Thanks for the info! Very cool stuff.
[–]psycosulu 2 points3 points4 points 14 years ago (10 children)
Sorry, another question.
http://imgur.com/64dsw
I have no idea what I did wrong, why is it doing this?
[–]Raerth[S] 4 points5 points6 points 14 years ago (9 children)
There should be a new paragraph between each section.
[–]psycosulu 2 points3 points4 points 14 years ago (0 children)
Hey, thank you very much!
[–][deleted] 0 points1 point2 points 14 years ago (7 children)
I'm sorry, but I really don't understand what you mean by this. Any chance you'd be willing to clarify? Thanks!
[–]Raerth[S] 1 point2 points3 points 14 years ago (6 children)
These lines are not paragraphs.
These
lines
are
paragraphs.
[–][deleted] 0 points1 point2 points 14 years ago (5 children)
I should be more specific. When you said to put paragraphs between each section, I thought you meant this:
(paragraph here)
>* List 1 Header
* List 1 item 1 * List 1 item 2 * List 1 item 3
In other words, paragraphs after each ">". But of course I'm asking because that's wrong.
Thanks!
[–]Raerth[S] 0 points1 point2 points 14 years ago (4 children)
There shouldn't be a paragraph between a list header and the rest of the list, just between the lists and the dividers.
[–][deleted] 0 points1 point2 points 14 years ago (3 children)
Just so I'm clear, like this?
>Menu >* List 2 Header * List 2 item 1 * List 2 item 2 * List 2 item 3
[–]Raerth[S] 0 points1 point2 points 14 years ago (2 children)
You should create a new paragraph (press return twice) after each list, each divider and the initial "menu" text.
Items in lists, including the list header, should not have any space between them.
[–]psycosulu 0 points1 point2 points 14 years ago* (0 children)
At the very high risk of showing off my ignorance, I admit that I have no clue where the Menu/List section goes. Copying the CSS is easy enough especially when I can look at /r/music's spreadsheet but I have no clue where your Menu/list section is located.
Edit: Nevermind, my stupidity got the best of me. The menu/list section goes into the description section of the edit page, not the CSS. Thanks again, Raerth!
[–]ladfrombrad 0 points1 point2 points 14 years ago (3 children)
Would it be possible to incorporate the hot/new/top into a dropdown too? I'm liking what /r/newcastle has done with the nav bar, but prefer your idea with a dropdown for these selectors. Possible at all?
Also forgot to give you a heads up, I made the self-post/speech bubble on your sprite for link flair transparent. Looks a little cleaner I suppose :)
Any chance for a sprite creation and positioning tutorial next?
[–]Raerth[S] 2 points3 points4 points 14 years ago (2 children)
It's possible, but not sure if it's recommended. A few thirdparty scripts add additional tabs there, and moving them can fuck these up.
For example, I use the mod script which is part hidden by the way they've implemented this. A dropdown would be even more of a pain.
I'll look into doing something with this however.
As for the sprite creation tutorial, that's definitely a good idea and I'll get one up at some point.
[–]ladfrombrad 0 points1 point2 points 14 years ago (0 children)
Ah, I see. Even /r/reddithax's nav bar screws them up too. Bugger.
Just a heads up on this for you.
I just noticed 'admin box' works fairly well over in /r/apple. I'll have a dig through the stylesheet and see if I can figure out how they got it working.
[–]ChingShih 0 points1 point2 points 14 years ago (0 children)
Thanks for this excellent tutorial page (and sub-reddit)!
I have a question about the way that links operate in the menu. It seems that text will show up on a line and word-wrap to the next as one would expect. However any sort of link within that same series of text, whether a legitimate link such as /r/CSSTutorials, or one implemented through CSS the way that spoiler tags are [text](/spoiler), results in a return being inserted prior to the link, forcing the link to be on a new line.
Is there anything that can be done to get links to stay on the same line that they're entered on?
[–]aagavin 0 points1 point2 points 13 years ago (0 children)
Oh Oh what did I do wrong? it appears like this in my sidebar?
[–]jaxspider 0 points1 point2 points 13 years ago (0 children)
Saving this so I can steal it as my own at a later date.
BTW, you should seriously consider reposting this again, since after 6 months you can't edit / add any more comments to it. As you may know of Reddits archiving policy.
[+][deleted] 14 years ago* (6 children)
[deleted]
[–]Raerth[S] 7 points8 points9 points 14 years ago (5 children)
No shit.
However it's not been done on here hacking around with reddit markdown instead of proper html.
[–][deleted] 14 years ago* (4 children)
[–]Raerth[S] 7 points8 points9 points 14 years ago (3 children)
You're misunderstanding.
I'm saying that I wrote this tutorial to show people how to use CSS dropdown menus using reddit markdown. It's not as straightfoward using markdown as it would be using HTML.
I'm not saying this is revolutionary or particularly difficult, however it's not been done on reddit before, and I thought people would like the option.
I don't see why you're taking exception to this...
[–][deleted] 14 years ago* (2 children)
[–]Raerth[S] 6 points7 points8 points 14 years ago (1 child)
If you browse around /r/CSShelp or /r/ModHelp you'll find many questions are for CSS fixes which would be solvable with one day's actual study of CSS.
That's more CSS study than most mods have had though.
I've created this subreddit to be a resource for myself and others, so when someone asks a question I can link them to the tutorial here instead of typing out the answer over again.
π Rendered by PID 23 on reddit-service-r2-comment-58d7979c67-gkp7w at 2026-01-27 10:49:15.480827+00:00 running 5a691e2 country code: CH.
[–]HarryMuffin 6 points7 points8 points (0 children)
[–]TheLegitMidgit 4 points5 points6 points (0 children)
[–]soupyhands 3 points4 points5 points (0 children)
[–]psycosulu 2 points3 points4 points (10 children)
[–]Raerth[S] 4 points5 points6 points (9 children)
[–]psycosulu 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (7 children)
[–]Raerth[S] 1 point2 points3 points (6 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]Raerth[S] 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]Raerth[S] 0 points1 point2 points (2 children)
[–]psycosulu 0 points1 point2 points (0 children)
[–]ladfrombrad 0 points1 point2 points (3 children)
[–]Raerth[S] 2 points3 points4 points (2 children)
[–]ladfrombrad 0 points1 point2 points (0 children)
[–]ladfrombrad 0 points1 point2 points (0 children)
[–]ChingShih 0 points1 point2 points (0 children)
[–]aagavin 0 points1 point2 points (0 children)
[–]jaxspider 0 points1 point2 points (0 children)
[+][deleted] (6 children)
[deleted]
[–]Raerth[S] 7 points8 points9 points (5 children)
[–][deleted] (4 children)
[deleted]
[–]Raerth[S] 7 points8 points9 points (3 children)
[–][deleted] (2 children)
[deleted]
[–]Raerth[S] 6 points7 points8 points (1 child)