Adding Custom CSS to a WordPress Site

When I first started blogging with WordPress, I needed some custom CSS. Being a WordPress n00b, I simply added it to the theme’s CSS file that controls what the site looks like. Of course, that bad decision came back to bite me in the butt and I moved to using a child theme to separate my custom CSS from the theme’s.

Timo Geusch over at The Lone C++ Coder’s Blog has another way of adding CSS to your site. His method requires the jetpack plugin but is easy to use once you have jetpack installed. Geusch says that he thinks adding a child theme is too heavy duty for what he wanted to do but I didn’t find it any more complicated that what he did. For example, here is my entire child theme

/*
 Theme Name:   Twenty Ten Child
 Theme URI:    http://irreal.org/twentyten-child/
 Description:  Twentyten Child Theme
 Author:       jcs
 Author URI:   http://irreal.org
 Template:     twentyten
 Version:      1.0.0
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twentyten-child
*/

@import url("../twentyten/style.css");

/* =Theme customization starts here
-------------------------------------------------------------- */
pre {
        font-family: "Courier 10 Pitch", Courier, monospace;
        border: 1pt solid black;
        padding: 3pt;
        background-color: #F0F8FF;
        overflow: auto;
}
.key, kbd {
        border:solid 1px #989898;
        border-radius: 3px;
        background-color: #F4F4F4;
        padding-left: .25ex;
        padding-right: .25ex;
        font-family: monospace;
}
.footpara:nth-child(2) { display: inline; }
.footpara { display: block; }
.footdef  { margin-bottom: 1em; }
#site-title {
        float: left;
        font-size: 60px;
        line-height: 36px;
        margin: 0 0 18px 0;
        width: 700px;
}

Other than the header, it’s just my custom CSS. Exactly like Geusch’s solution.

Whatever method you like best, be sure to use one of them if you want to add some custom CSS. Believe me, you don’t want the pain that messing with the theme’s CSS will bring you.

This entry was posted in General and tagged , , . Bookmark the permalink.