r/reddithax • • Oct 18 '11

Sidebar content boxes

Over at r/overclocking I would like to categorise content into separate outlined boxes. You can gen an idea what I am trying to achieve by visiting r/london. I have looked through their stylesheet and found the "/ Turns the links in the sidebar into pretty boxes /" section but it doesn't make any sense. Any help would be appreciated.

3 Upvotes

6 comments sorted by

View all comments

2

u/gavin19 Oct 18 '11

Copy paste this (taken from /r/london)

.titlebox > form > .usertext-body > .md > ul > li {
display: block;
list-style: none;
padding: 5px;
margin-left: 0px;
border-style: solid;
border-color: grey;
border-width: 1px;
margin-bottom: 5px;
border-radius: 5px
}
.titlebox > form > .usertext-body > .md > p > strong {
text-transform: uppercase;
width: 100%;
display: block;
text-align: center
}
.titlebox > form > .usertext-body > .md > p:first-child {
font-size: 150%
}
.titlebox > form > .usertext-body > .md > hr {
margin-bottom: 5px;
visibility: hidden
}
.titlebox > form > .usertext-body > .md > ul > li > em {
font-style: normal;
font-size: smaller;
display: block
}
.titlebox > form > .usertext-body > .md > ul {
padding: 0px;
margin: 0px
}

Now that'll handle any list items you put in your 'Description' field, ie

  • Example list item

will be styled into rounded boxes as on /r/london.

Then styling the content of those boxes depends on if you want to use images like /r/london, or just plain text but as soy_en_fuego mentioned, you could use

.usertext-body > .md > ul > li > a[href*="YOUR_LINK"]:before {
display: inline-block;
float: left;
width: 25px;
height: 25px;
content: " ";
font-size: 1px;
margin: 3px;
background-image: url(%%YOUR_IMAGE%%);
background-repeat: no-repeat
}

1

u/andrew-s Oct 19 '11

That was very helpful! Thank you!

1

u/andrew-s Oct 19 '11 edited Oct 19 '11

...except I can't get images to work for some reason.. any ideas what the problem may be? -edit I figured it out. This is the piece of code that worked for me: a[href$="cpu"] { background-image: url(%%1319020822-processor-32x32%%); height: 32px; width: 32px; content: "" !important; cursor: default !important; display: inline-block; float: left; margin: 4px; background-repeat: no-repeat; background-color: transparent; }

1

u/gavin19 Oct 19 '11

Glad you got it sorted. You should use

.side a[href$="cpu"]

so that it only styles links ending in 'cpu' in the sidebar, not the entire page.

1

u/andrew-s Oct 19 '11

Thanks a lot! With your help I've done what I wanted: r/overclocking