Pages Navigation Menu

Software Mastery, the Fun Way

Why isn’t my HTML / CSS working?

One of the most common questions I get asked related to beginning HTML and CSS is “Why isn’t this working?” Unfortunately, I can’t look at everyone’s individual project or I wouldn’t have time to do my own projects, but now and I then I do take a look if it looks like it will be something fast and one of the most common errors I see is special characters in the text. This often happens when you cut and paste from a program like Microsoft Word, which uses special characters for characters like quotes. In fact, that was exactly the case today, when I received a question from a reader who was stuck on the very first example from Head First HTML with CSS & XHTML; his CSS just wasn’t working and he was incredibly frustrated, understandably so! When I loaded his HTML file and took a look at the source using my browser, I noticed that his opening style tag had special characters around the type attribute:

This type of error is hard to catch, especially for beginners. In your editor, you’re seeing quotes, so you never know there’s a problem unless you “view source” using your browser and see the special characters in the source window (which displays plain text).

So, two tips:

  1. Make sure your editor is set to plain text so no special characters are inserted into your HTML and CSS
  2. If you’re having problems, look at the source using the “view source” menu (in Safari, View > Source). This will often uncover problems like special characters that you might not be seeing in your regular editor.

Keep sending your questions; we’ll try to answer them personally or on the blog!

BE A WICKEDLY SMART INSIDER, FREE!

Want early access to all our books, code, tips and videos?

We regularly send out tips, videos, early access chapters and articles and news on new ways to learn coding. Sign up and we'll inform you every time. And, we'll always protect your privacy!