Creating a "top bar" on /r/CtrlAltDefeated

Currently using a modified version of r/Naut. I'm trying to create a little bar at the top of the screen, with some helpful links, such as r/wow or many other subreddits have. I believe this is usually done through putting something in the sidebar with a certain amount of hashtags/quotes/bullets and the stylesheet picking it up and placing it neatly at the top.

I'm currently at this.

I'd want it to look like this.

I already have the images set up (and linking somewhere else), I only can't figure out what CSS I need to make the icons go from the sidebar to the top, and making the top bar fit in with the rest of the theme.

Any help would be greatly appreciated!

Posted Jan 28, 2016, 12:53 PM UTC

25
gavin19•

For the bar itself, replace

div.content {
margin-top:96px;
}
.titlebox form {
position: static
}
.side h5:nth-of-type(1) {
position:absolute;
display: block;
top:196px;
left:10px;
background-color: #313131;
color: #fcfcfc;
text-align: left;
margin: 5px;
border-radius: 2px;
width: 60%;
padding: 7px 0px 7px 40px;
}

with

body > .content {
    margin-top: 80px;
}
.side .md h5:first-child {
    position: absolute;
    top: 208px;
    left: 16px;
    border-radius: 2px;
    height: 54px;
    margin: 0;
    padding: 2px 4px;
}

For the links within the bar, you're mostly there. Replace

.side .md a[href*="#linktile"] {
  content: "";
  display: inline-block;
  height: 50px;
  width: 50px;
  background: url(%%link-tiles%%) no-repeat;
  margin-right: 6px;
}

.side .md a[href*="#linktile2"] {
  content: "";
  display: inline-block;
  height: 50px;
  width: 100px;
  background: url(%%link-tiles%%) no-repeat;
  margin-right: 6px;
}

.side .md a[href*="#linktile"]:hover,.side .md a[href*="#linktile2"]:hover {
  opacity: .8;
}
.side .md a[href*="#Discord"] {
  background-position: 0px 0px;
}

.side .md a[href*="#Twitter"] {
  background-position: 0px -50px;
}

.side .md a[href*="#Forums"] {
  background-position: 0px -100px;
}

.side .md a[href*="#Thunder"] {
  background-position: 0px -150px;
}

.side .md a[href*="#Reddit"] {
  background-position: 0px -200px;
}
.side .md a[href*="#Community"] {
  background-position: 0px -250px;
}
.side .md a[href*="#Official"] {
  background-position: 0px -300px;
}

with

.side .md h5:first-child a {
    background: url(%%link-tiles%%);
    display: inline-block;
    height: 50px;
    width: 50px;
}
.side .md h5:first-child a + a { margin-left: 6px; }
.side .md h5:first-child a:hover { opacity: .8; }
.side .md h5 [href*="#Discord"] { background-position: 0 0; }
.side .md h5 [href*="#Twitter"] { background-position: 0 -50px; }
.side .md h5 [href*="#Forums"] { background-position: 0 -100px; }
.side .md h5 [href*="#Thunder"] { background-position: 0 -150px; }
.side .md h5 [href*="#Reddit"] { background-position: 0 -200px; width: 100px; }
.side .md h5 [href*="#Community"] { background-position: 0 -250px; width: 100px; }
.side .md h5 [href*="#Official"] { background-position: 0 -300px; width: 100px; }

and when you make your real links in the sidebar, like

#####[](//twitter.com/something)[](//reddit.com/r/something)

etc, then you can change the CSS to match, so

.side .md h5 [href*="#Reddit"] { ... }

would become

.side .md h5 [href="//reddit.com/r/something"] { ... }
1
CtrlAltDefeatedOP•

Hey, awesome! Thanks for checking out, I'll give it a try.

1
CtrlAltDefeatedOP•

Tiny question. Isn't

 .side .md h5 [href*="#Discord"] { background-position: 0 0; }

Supposed to become this?

 .side .md h5 a[href*="#Discord"] { background-position: 0 0; }

And of course for the other images. It seems that without that, it doesn't actually select the correct image from the file.

1
gavin19•

I forgot to change

background: url(%%link-tiles%%);

to

background-image: url(%%link-tiles%%);
1
CtrlAltDefeatedOP•

Ah. Thanks!

1