If you have the wp.com CSS Upgrade

The common mistake 98% of people, who have the CSS upgrade, make when modifying a theme is to paste the WHOLE theme’s CSS code in the CSS Editor. DO NOT DO THAT!

If you have the CSS Upgrade, put only your additions/modifications to the theme’s CSS in the editor; code other than that is just an overkill.

A few reasons why pasting the whole code is not a good idea are:

  • You’re duplicating code that has already been written for you
  • Relative paths to background images will be broken giving you undesired results
  • The browser will download the same code twice which is inefficient.

Why will the browser download the code twice?
Because whenever your browser requests a page, the server (in this case wp.com) will send something like this:

(default .css file)
body {background: #fff; color: #339;}
...
...
...
[more css code]
...
...

(your code in the CSS editor)
body {background: #fff; color: #339;}
...
...
...

That’s an overkill because your code will ALWAYS be appended at the end to override whatever definitions were defined in the default .css file. By copying the entire CSS in the editor, you’re telling the browser to do the same thing twice… hence, overkill.

Now, let’s say you just want to change the color of your font from dark blue (#339) to black (#000); since the default body definition looks already like this:

body {
     background: #fff;
     color: #339;
     font: normal 1em Arial, Verdana, Sans;
}

The ONLY thing you need to write in your CSS editor is this:

body {color: #000;}

The server will send the code like this:

(default .css file)
body {
     background: #fff;
     color: #339;
     font: normal 1em Arial, Verdana, Sans;
}
...
...
[more css code]
...
...

(your code in the CSS editor)
body {color: #000;}
...
...

The first definition (default .css file) will set the background to white, the font to Arial and the color to dark blue (#330), but when the browser gets to YOUR definition, it will say: “oh, so the text color is not dark blue anymore but black… okay!”

That’s how CSS works, the definitions that are at the “bottom” are the ones that will take priority.

If you wanted to ADD to an existing definition, say a padding of 10px to the 4 sides of the page, then you’d write it like this:

body{padding: 10px;}

Then the browser will combine the default definition with yours… it would be as though your theme had this CSS code:

body {
     background: #fff;
     color: #339;
     font: normal 1em Arial, Verdana, Sans;
     padding: 10px;
}

By not putting the entire CSS code in the CSS Editor, you’ll help yourself to keep track of your changes, and when you mess something up, it will help those who may be able to help you to fix whatever may be borked.

I hope this helps. I’ll come with more tips/recommendations soon (I hope).

Cheers!

Feed Your Cats and Tags

After a long hiatus, here’s a new tip. It’s not about CSS, but I hope someone will find it useful.

Just in case you didn’t know (I sure didn’t and found out because we needed to do this for a blog at my job) you can serve feeds of a specific category/tag to your readership.

Say you have readers that have subscribed to your blog; obviously they will know every time you post a new article but sometimes, I will dare to assume, such article will not be of interest to some of them because they’re interested only in whatever you post under “CSS Tips.” To make things more convenient for them, you could serve RSS feeds only of those categories/tags they may be interested in. Example:

The following code:

<a href="http://csswiz.wordpress.com/category/css-tips/feed/">CSS Tips RSS</a>

will produce:

CSS Tips RSS

Neat, huh?

What if you wanna serve RSS feeds for a specific tag? Then the URL would look something like this:

<a href="http://YOURBLOG.wordpress.com/tag/YOUR-TAG-NAME/feed/">Your Tag RSS</a>

That’s it. Hope you find this helpful.

Photo Blog

This post has nothing to do with CSS. Just promoting my new photo blog. Check it out if you’d like.

http://photoblog.mycoolrealm.com/

Cheers!

Skin Prototypes

Sometimes, I work on skin prototypes that I might complete or delete. Some of these prototypes stay on my local drive, others may see some “light” and get installed on my old Sandbox Skins blog… like this one:

Prototype

I might improve/polish this one… or I just might toss it. We’ll see.

Death to “Click Here”!

A while ago, I wrote on my programming blog why using “Click Here” as link text is bad… I thought it would be a good idea to post it here as well.

It’s really annoying to find websites that have the words “click here” to link to other pages… And is very bothersome to find people or companies that use this bad linking practice because ‘other people/companies do it and it works for them’ … WHAT?? To me, that’s just a lame excuse.

If you’re gonna follow the example of other people (to do what has worked for them), can’t you have the ‘imagination’ to at least improve it, and hence, make it better? Do you have to make it the ’same’ way because ‘if it has worked for them, it will work for you”? BAH!

It is my personal opinion that there is nothing wrong to follow good examples, but it would be a better idea to discard the bad ones and, like I said, make it better.

There is a very useful article that explains why “click here” is a bad linking practice. Some points of why it is a bad practice are:

  • “Click here” just looks stupid.
  • “Click here” looks especially stupid when printed on paper.
  • “Click here” is bad food for search engines.

The W3C (World Wide Web Consortium) has a QA tip called ‘Don’t say “click here” as link text‘. It recommends that:

When calling the user to action, use brief but meaningful link text that:

  • provides some information when read out of context
  • explains what the link offers
  • doesn’t talk about mechanics
  • is not a verb phrase

Also, the W3C in the HTML Techniques for Web Content Accessibility Guidelines 1.0, Section 6.1 Link text, explains:

Good link text should not be overly general; don’t use “click here.” Not only is this phrase device-dependent (it implies a pointing device) it says nothing about what is to be found if the link if followed. Instead of “click here”, link text should indicate the nature of the link target, as in “more information about sea lions” or “text-only version of this page”.

So, in conclusion, death to “click here” text link! >:D

———-
You know what really makes me mad? EVERYTHING!!! – Ranting Swede