Adding CSS to Your Website
by Paul Clukey
CSS stands for cascading style sheets. For a lot of my projects, I like to use WordPress. WordPress offers the ability to add special CSS to a website.
Styling Your Website
The area where users can add CSS is found under Customize in the Appearance section of a WordPress theme. Usually, it is titled Custom CSS. This is where you can add different classes in order to style your website the way that you want. This can be especially helpful since you don’t have to go into the server and look for the CSS files. This can prevent you from wrecking your website by changing something that has a more significant impact than you expected.
Create and Name Your Classes
So what is a class? You can create a class for a specific customized area on your site. In the class, you can create specialized font families, unique colors, unique font sizes, backgrounds and other aspects of your WordPress site.
I like to use specific classes to identify the styles that I create personally. I often encourage developers to use their names when creating a class to make sure that in the future, should anything not work correctly, I can go back to that person and ask them exactly what their intent was with the style that they created.
This is what makes current HTML so helpful. By being able to designate classes within style sheets, you can quickly make site-wide changes to select areas without having to do a bunch of inline CSS.
Don’t get me wrong. I am a big fan of in-line CSS because I can quickly make formatting changes to my blog posts and pages. However, in the back of my mind, I always consider that I may have to do a lot of updating in the future. When it comes to web marketing, there still many things that are changing. You want to allow yourself the flexibility to maintain a corporate ID sitewide while also keeping relevant current information on your blog posts and pages.
Educate Yourself
Don’t let CSS and HTML be intimidating. One of the best things that I’ve ever done for myself was to take courses on these subjects. I ran through the courses daily on a self-directed basis. I found that because I’m programming every day, the course addressed my questions and made my life a lot easier. Things like margins and borders and content blocks became a lot more crystallized when I took the time to do these studies.
The more I learn, the more I realize that anyone can learn this information. It simply takes some discipline and practice. The easiest way to do that is to create a sandbox site and run through the changes you learned how to make in the course.
Validate Your Site
One final thought.
I like to run all of my websites through the WC3 validator. It points out any flaws in my CSS code. It also allows me to go in and correct mistakes. While many browsers are very forgiving in their display of HTML and CSS, I like to make their jobs a bit easier. I also believe that the major search engines give special treatment to websites that maintain quality code. I acknowledge that this is somewhat speculative; nevertheless, I have seen some cases where rankings have improved from updating and validating sites.
Here’s to happy CSS coding. Talk to you in the next blog!