Disqus Custom CSS Styling in 3 Easy Steps

Posted on Jun 24 by ack.
Categories: ack, online, usability, web 2.0.

DisqusSo I have been running Disqus on this blog for over a year now, and I am a huge fan of the service. [Ed note: I got a little fired up here, so feel free to jump right to the steps.] My prior experience with comments had me deleting at least a few comments daily, all being spam. Akismet has improved much since then, but with Disqus I now have only had to remove 1-2 spam comments this past year. That is fantastic results. I also recently checked a friends dormant blog and there were 112K spam comments missed by Akismet needing approval, yes, that’s thousands!

So this is a very cool tech company based in NYC with money from Fred Wilson’s Union Square Ventures (which is how I first heard of Disqus). But what I just don’t get is how they don’t give more support for changing the look and feel of the content they put on my blog.

I understand completely that they can’t actually help individuals with how to code their pages, but the best info they have is on this Disqus wiki page on Custom CSS? I would love to hear any non-html-developer try and make use of that page. It was either written by developers who have long forgotten what it is like to deal with non-developers, or the lawyers got involved (And I don’t consider myself enough of an expert on the topic to start editing their wiki page). By support, all that is needed is a good sample and walk-thru webpage.

Now Disque is a completely user-friendly service that requires only a bit of copy and paste of a line of code, it is perfectly targeted at the non-technical (blogging) audience, yet they really dropped the ball at the last possible moment. Their code and styling look great on untextured white background, and nothing else, and pretty much disappear on a black background based site like mine.

So I mentioned I have been using Disqus for a year, so how did I solve this problem? I didn’t. For the last year I have had black text comments on a black background. You see, when I set this up, I went to try and change the styling from the Disqus admin, where of course it is never even mentioned. From a Google search, all I got was the above page telling me to create something from scratch using whatever elements listed on the page I wanted to use, which frankly is so unhelpful and a waste of my time. So since I have have a very low commented site, I didn’t bother.

But now I actually know enough CSS to be dangerous, so I thought I would finally tackle the issue. As a bonus I assumed with a year passed there should be some better examples floating around, but I was wrong. So now I am providing what I did to solve this simple issue, that I have seen many many people still have.

So here is my own sample for anyone trying to create custom background and text colors for Disqus in three easy steps:

Step 1: Start with a Disqus CSS sample, here is mine: disqus-form.css and save it so that you can edit it.

Step 2: Edit it. HTML and CSS can look scary, but you only actually have to start with one small section to change the background and font text color for the entire Disqus section (which is all I’ve been trying to do). Then upload the file to your blog.

/* Everything Disqus on your page is contained within this. */
#disqus_thread {
background-color: #000000;
color: #ffffff;
border-style: solid;
border-color: #cccccc;
padding: 5px;
}

Now this looks intimidating, but all you need to know about colors is that “ffffff” is white and “000000″ is black (”cccccc” is gray). So my background color is black and my (font) color is white. If you want to get more tricky then those, look up your html color. Border-color is a gray line around the Disqus area, and the Padding gives a little space around the outside (5 pixels worth).

Step 3: You will need to add the following bit of code to your Wordpress/blog header template file, inside the “head” tag. Change “yourblog.com” to your blog address and where you uploaded the file. Save the template header when done.

<script type="text/javascript">var disqus_iframe_css = "http://www.yourblog.com/disqus-form.css";</script>
<link type="text/css" rel="stylesheet" href="http://www.yourblog.com/disqus-form.css" media="screen" />

Guess what, you are done. Hope this helps.

I think it is ALWAYS better to provide a template that has good simple notations for people to make changes, so I grabbed the initial CSS file from this forum post. Most of the advice was to add only the first line to your template header and make half the changes to the CSS in your blog’s template CSS, and I find that too confusing, so I combined them into the same file.

I know I didn’t explain how to find your template files or what all the CSS options are, or even what CSS stands for (Cascading Style Sheets), but that’s what Google is for once you get the basics done. Good luck.

[Ed: added a link to the initial CSS file]

View Comments

  • Great article, and just what I needed. Thanks so much!
  • Thanks so much!!!
  • Thanks for the awesome css script, really appreciate the trouble you went through to put this together
  • I got rid of the margin. :D But now I can't take off the border! Does anyone know how? Here's my blog: http://glennpaoloagoopio.blogspot.com/ I will be immensely grateful!
  • How did you get rid of the margin? I still can't get rid of the margin! Please, help me!! T_T
  • thanks!
  • Hello,

    Do you know how to customize the newest disqus version? I've asked this about 100 times over at disqus, and each answer says "I'm checking on it". So I will assume there is no answer by now. My question being, how in the heck can I change the background color of the textarea (the comment area) in the iframe???

    If you know a way then cool - let me now! If not, will this work??? What if I download this script http://disqus.com/forums/visibilityinherit/embed.js and host it on my server and edit the background color in there. Will that work? If so, where do I edit it? Thanks for your time!
  • dloewen
    I had the same issue, you can't style it directly. Instead, use the disqus_iframe_css variable to give the iframe your css. After that, it works!

    See http://disqus.com/docs/embed/
  • Thanks so much, this solved a weeks worth of toiling over the Disqus import css function not working!
  • Many thanks to Adam and "All That Is." Step 3 also fixed my "Disqus import css" not working, and AllThat's post showed up on Google ;)
  • Aaaaand nevermind. Still doesn't work. Put a request into Disqus, we'll see :)
  • thanks so much..your a lifesaver!
  • Thanks so much friends... Keep writing other tuts...
  • Guest
    i wanted to say that the little rotating circlar pin wheel load icon does not show well against the black background. It shows like a grainy edged GIF. Is their a way to change this?
  • Guest
    no one likes to see the (Mick) Jaggies!
  • Guest
    Hey thanks for this article. I just want to put in my 2 right here. After going through the disqus style sheet with Fire Bug I counted around 240 selectors (elements) to style. Obviously most of those one does not initially see but seriously, there should be a thorough, comprehensive guide which explains what every selector does in a detailed fashion. I know DISQUS is a free service but they should focus on bringing better quality to the developer/designer table, not just the hobbyist blogger table. That should be a priority. Not everyone is a high level, very experienced developer or has tons of time to go through 240 selectors. Perhaps they dont put a thorough guide up because they dont want people having the ability to add their custom styles?

    Anyways the style sheet you indirectly linked to:

    http://www.klatergoud.com/wordpress/wp-content/themes/klatergoud/disqus.css

    It's proper for the basics but after that and I am thankful for that. Peace!
  • I agree, having a reference guide for the elements would make it much more useful and powerful. I don't actually think they are trying to limit custom styles, my impression is that they are leaving it wide open for custom styles and they are doing as little as possible. Probably comes down to them not having a lot of time to put it together.
  • Guest
    right, well hopefully someone in the community will put one together, like what you have done here. but 240 selectors = lot of time.
  • I just added Disqus to my WordPress blog. I'm wondering if anyone has thoughts about whether using Disqus creates the problem of duplicate content for search engines, as what would have been posted once on one's site is now also posted on the discus site.
  • I've not noticed any duplicate content in regards to search, at least when using the JS version that places the content directly on your page. Not sure what would happen if you had the content in an iFrame though, but either way we are only talking about the comments, not the posts.
  • You only need to worry about duplicate content when it's on your own site, not on yours and another site.
blog comments powered by Disqus