Home > Articles > Web Development

Seven Common CSS Mistakes and How to Avoid Them

Ivan Pepelnjak
  • PrintPrint
  • Share ThisShare This
  • DiscussDiscuss
Close WindowIvan Pepelnjak

Ivan Pepelnjak

Learn more…

Find Facebook Friends with Your Facebook Connect Application
Dec 28, 2009
Publish Your Application Stories to Facebook
Oct 21, 2009
Use Facebook Connect to Bring Your Application to Millions of Users
Aug 31, 2009
Developing AJAX Applications with jQuery
Jun 30, 2009
Web Page Refactoring with jQuery
Jun 10, 2009
Introduction to jQuery: Use jQuery to Write Simpler, Shorter, More Readable JavaScript Code
Jun 1, 2009
Testing Your Website in a Realistic Environment
Aug 5, 2008
Fix Your Web Site Performance Problems
Jul 30, 2008
Why Is My Web Site So Slow for Global Visitors?
Jul 21, 2008
Generating Atom Feed from SQL Data
Mar 31, 2008
Implementing Access Controls on SQL Server Data
Mar 14, 2008
Make Your Web Pages Mobile-Friendly
Jan 18, 2008
Use Google as Your Gateway to the Mobile Internet
Dec 28, 2007
Enhance Your AJAX Applications with Visual Cues
Dec 14, 2007
Building Modal Dialogs into Your Web Application
Nov 9, 2007
Adding Keyboard Shortcuts to Your Web User Interface
Nov 2, 2007
XML Handling in Microsoft SQL Server 2005
Oct 19, 2007
Storing XML Data in a Relational Database
Oct 5, 2007
Serve SQL Data in XML Format
Sep 28, 2007
Enrich Your HTML Tables with JavaScript Progressive Enhancement
Sep 7, 2007
Introduction to HIJAX
Aug 24, 2007
Seven Common CSS Mistakes and How to Avoid Them
Jul 20, 2007
JavaScript Progressive Enhancement in Practice
Jun 15, 2007
Make Pop-Up Windows Visible to Search Engines
Feb 16, 2007
Automate the Pagination of Your Web Pages
Feb 2, 2007
Using WordProcessingML to Generate Clean HTML from Word
Jan 26, 2007
Optimized Presentation of XML Content
Dec 15, 2006
Reap the Benefits of Web Caching, Part 3: Database Integration
Nov 22, 2006
Reap the Benefits of Web Caching, Part 2: Reduce the Download Time
Nov 17, 2006
Reap the Benefits of Web Caching, Part 1: Explicit Content Expiration
Oct 27, 2006
Improve Your Search Engine Ranking with AJAX
Jul 28, 2006
Using Multicast Domains
Jun 27, 2003
Should I Be Interested in MPLS Traffic Engineering?
Jan 3, 2003
Is Troubleshooting Important?
Dec 27, 2002
MPLS/VPN Architecture Overview
Aug 2, 2002
Multiprotocol Label Switching (MPLS) Architecture Overview
Jan 1, 2001
JavaScript Modal Dialog Box in a Frameset Environment
By on December 12, 2007 1 Comment

Only a few modifications are needed to adapt the solution I've described in the Building Modal Dialogs into Your Web Application to a frameset environment.

Sams Teach Yourself CSS in 24 Hours, 2nd Edition

Like this article? We recommend
Sams Teach Yourself CSS in 24 Hours, 2nd Edition

Although CSS is one of those technologies that you should learn systematically from a high-quality source, most of us jump into it erratically and try to learn by doing. Instead of repeating the same mistakes over and over, Ivan Pepelnjak summarizes some of the most common ones and tells you how to avoid them.

I can easily claim I was one of the early adopters of the Web technologies (well, HTML in those days)—we were developing CGI-based network management applications before Marc Andreessen finished the first public release of the Netscape browser. Formatting was easy in those days—there was none (and if you wanted to achieve special effects, such as using a font you liked, you had to do it with images). When the browser wars started, I gave up and focused on core IP networking, only to find a drastically changed landscape when I returned to Web development a few years ago.

As the timing was short (as always), I had to jump head-on into the new technologies that were developed while I was absent and since I knew a bit about HTML from my early days (actually, apart from a plethora of new tags and attributes, it hasn’t changed that much), CSS was the first new technology I had to master.

Doing Before Learning

In retrospect, it would have been much better if I postponed my tasks at hand for a few weeks, got a copy of a good CSS-related book, and spent some time studying it. But as we all do, I relied on my friend Google to find answers to the specific immediate issues I had... and the application started to grow in unpredictable directions. Unfortunately, it got out of hand before I mastered the nuances of CSS and I still have to live with it because it supports a lot of content I’m publishing (and I never found time to completely redesign it).

In this article, I’ve collected the most common mistakes I’ve been making (and I’ve seen a lot of other developers doing the same), illustrating them on a simple tabular printout.

The next sections are focused exclusively on ways you can improve the efficiency of your CSS formatting and reduce the size of your HTML markup. I will not go into oft-discussed topics (such as "why I should use floating layouts instead of tables" or "how to make a flexible two-column layout") because there are many good books and articles covering those topics.

  • Share ThisShare This
  • Your Account

Discussions

can't find stuff
Posted Apr 19, 2008 03:49 PM by zwickykat
0 Replies

Make a New Comment

You must log in in order to post a comment.

Related Resources

You Can Check Out Any Time You Like, But You Can Never Leave
By John Traenkenschuh on December 8, 2009 No Comments

Much like the line from the song, "Hotel California", Traenk finds out that membership with key Internet II sites is eternal...

Predictions and Predilections
By John Traenkenschuh on November 23, 2009 No Comments

Leaves are down; harvest is in, for the most part.  Another year comes rushing up to us.  What will it bring?

Drupal Theming Toolkit
By Emma Hogbin on March 9, 2009 1 Comment
Programmers and designers have a huge range of tools available from Vim and Emacs to Illustrator and Inkscape. But there are also those in-between folks who are responsible for taking graphic files and converting them into the template files that are applied to Web CMSes. In the Drupal world these people are known as "themers." During my DrupalCon presentation this past week in Washington, DC, I asked themers to blog their toolkit so that we can learn from one another and work towards a "best practices" toolkit. This post shows you my top six favorite tools in my Drupal theming toolkit.

See All Related Blogs

Informit Network