Ian Hoar – Passion for Technology – Geeking Out - Technology, Web, Toys, Games, Design, Entertainment, Gadgets, & Geeking Out

Using custom CSS and Javascript in WordPress posts

Using custom CSS and Javascript in WordPress postsToday while writing The secrets to using custom web fonts I ran into a bit of a snag. I wanted to show several CSS driven examples within the post, but the WordPress editor would remove anything I added. I have dealt with this issue in the past, usually in a clunky manner or even hosted separate example pages. This time though I really wanted the font examples to show up within the actual page content and I didn’t want to add more styles to my WordPress theme. The method I used is remarkably easy and can be implemented in about two or three minutes.

Keep Reading 

How to write super clean CSS

Clean CSSEveryone who works with (X)HTML probably knows how to use CSS to some degree, but not as many know how to write clean CSS. Cascading Style Sheets are probably one of the most powerful tools a web designer/developer can master. It’s hard to find a site today that doesn’t benefit from the capabilities of CSS, and with the slow arrival of CSS3 that is unlikely to change. That said I still constantly come across style sheets that could be cleaner, more optimized, and more elegant.

Keep Reading 

CSS tip, declare your font family once

Here’s a CSS tip that I wish more people would follow. When setting up a font on your site, say Verdana, there is no reason to declare it on every H tag, P tag and class you are using. Throw it up in the body and be done with it. The same goes for font sizes, colours and anything else that will be uniform across the site. Once you have done this you can override it for specific tags and classes when you need too.

body {
	font-family:Verdana, Arial, sans-serif;

This will make your life easier and everyone else who has to work with your files will thank you. I think we should always be looking for ways to make our CSS smaller, cleaner and easier to read.