CSS Depricated Attributes

Here is a list of depricated attributes I pulled off CSS-Tricks.com

Depricated Attributes:

  • align: e.g. <p align=”left”>. Still works just fine, but you really should just apply a class and give that class a style of text-align: left; Or, if you have to, apply in-line CSS like style=”text-align: left;”.
  • bgcolor: e.g. <table bgcolor=”FFF”>. I see this one all the time with many of the “copy-and-paste” code generators out there. They use it because they want to have full control over the look of whatever you are copying and pasting, and it works. But seriously, just apply a class or use style=”background-color: #FFF;”.
  • border: e.g. <img src=”#” alt=”” border=0 />. This is probably the most common of all the deprecated elements. Borders on images generally look awful on webpages and should never be set as a default without a good aesthetic reason. By default on most browsers images don’t have border, except when they are used as LINKS. Then the default is to use some kind of nasty blue border. Many people force-avoid this by putting the border=0 right inside the img element. You can much more easily and cleanly avoid this with a single line of CSS: a img {border: 0px;}.
  • height / width: e.g. <div width=150>. Not cool yo. Give that div and ID or class and put the width in the CSS where it belongs.
  • target: e.g. <a href=”#” target=”_blank”>. Not only is it deprecated, it’s a usability faux paux. Smashing Magazine has a great quote about it:

    Visitors want to have control over everything what happens in their browser. If they’d like to open a link in a new window they will. If they don’t want to, they won’t. If your links open in a new window you make the decision which is not your decision to make.

  • nowrap: e.g. <td nowrap>. This one comes from the table days when you wanted to make sure one cell of text would all stay on one line (not wrap). CSS has that one covered with the the white-space property. Just set white-space: nowrap;.
Do Us a Favor:
  • Digg
  • Reddit
  • Facebook
  • del.icio.us
  • Mixx
  • StumbleUpon

Leave a Reply

You must be logged in to post a comment.