As a Web Designer, we sometimes get comfortable in old ways of designing, especially when trying to make your design cross browser compatible. This post is regarding some things to remember when making the leap toward designing with XHTML Strict document type.
When going from XHTML Transitional to XHTML Strict, remember to declare the proper document type. When you crack open Dreamweaver and open a new page, change the “Document Type (DTD)” to “XHTML 1.0 Strict”
Common character sets I use are “ISO 8859-1″ and “UTF-8″. ISO 8859-1 characters are typically used throughout The Americas, Western Europe, Oceania, and much of Africa. While UTF-8 is the standard encoding for XML. Choose a Content Type and stick to it.
Sometimes I’m guilty of old ways of designing by dragging elements into the page using Dreamweaver or quickly hand coding tags without properly closing single element tags such as:
Here’s a sample of how they should be closed (note slash />):
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" /> <img src="logo_antonio-wells.gif" alt="Alt Text" /> <input id="text" type="text" value="" /> <br /> <hr />
In HTML, it should be "&" and not just the single "&".
If you use an “img” tag in your design, please use the “alt” attribute or it will be flagged. Try to refrain from using the ”img” tag in the presentation layer, yet leave it to CSS in background images.
The “language” attribute is deprecated, therefore using it in a JavaScript reference tag is no longer needed.
Here’s a sample of how they should be referenced:
<script type="text/javascript" src="js/jquery-1.2.6.min.js"></script>
XHTML Strict expects you to use a “fieldset” element within your “form” tag. Designers unfamiliar with how to control the presentational behaviour of this tag avoid it. See below a little CSS reference how to remove the border around a “fieldset” element:
fieldset { border: 0px; }
Bottomline, if you’re not properly nesting your HTML tags you wont validate. Using a tool like Dreamweaver will prevent this error from happening while designing. If you’re a hand-coder or hybrid-coder (someone who knows HTML… still uses a visual editor yet digs into the HTML and write some hand-code) like myself, you are subject to error.
Some common practices I engage when hybrid-coding is opening and closing a tag elements right away, then come back and fill in the tag. Another is making the code hierarchical to see the child elements easier. A great tool for helping with this is Visual Studiofor its IntelliSense and hierarchical code formatting capabilities. I use Control K+D a lot in that app
Some old school elements and attributes are hard to stay away from, but you must be slapped on the wrist and stay away from the below if you wish to validate. (Quick list courtesy of 24 Ways.org)
Some Elements:
Some Attributes:
The one I have problems with is the “target” attribute, there is no way for easily liking to a new window other than writing JavaScript to achieve the same effect. In my opinion, that is a step backwards in Web Standards. I do understand why it was depreciated, because it was initially related to calling frames within an ”iframe” set. I believe it should have been left alone or replaced. A useful practical use I use it for it on this blog when linking to other websites. I makes for a better user experience not to lose the page I reading while exploring referenced websites on a post. A workaround is to use browser features like “Open this link in a new tab”.
Lastly, please validate your design with the W3C Markup Validation Service. It gives advise on what’s wrong and how to fix it. Becoming disciplined in properly coding markup helps Web Standards, accessibility, and your own skill set marketability. Completely separate content from presentation… that’s what CSS is for… covered in the next Web Design Tip!
Why on earth would you use Dreamweaver?
maybe because over the years you are used to it (e.g. shortcuts) or because you can use it on mac and windows.
i am using it although i am very annoyed by the bugs making it crash at least once a week.
would i use mac only than i probably would give ‘coda’ a try.
Nothing wrong with using DW. It is just a tool like any other. It is how you use it that makes the difference.
Very nice post. I am amazed at how many problems I find from coders using the wrong doctype.
@Mike… What tool do you use and what platform do you design/develop on?
I’m a PC guy who does development on PHP and ASP.NET
Like Dirk said, I got used to it over the years and was a huge Macromedia fan, and even more Adobe fan now that all those tools are interlinked.
What I like about DW is: CSS Editor, File and Site Manager, ability to connect to remote FTP server and set Localhost development environment, and when clients send content in nasty formatted Word docs… Copy/Pasting into DW cleans the HTML alot!
Antonio.. I work on use BBEdit on the Mac along with Firebug and the web developer toolbar. By default DW gives you horrible bloated code and by the time you have cleaned it up you might as well have just written it yourself in the first place.
Having said all of that, with the benefit of hindsight, Textmate or Coda are probably better choices.
I only ever use Windows for testing in IE. Mac for work and Ubuntu for fun!
I use Aptana most of the time now days, but DW has a sweet global find-and-replace.
I like to run my code through W3C’s validation service. Even though I’m aware of the different doctypes and their rules, I still find myself making mistakes here and there.
(X)HTML is coding now?
XHTML is a standard of HTML by the W3C http://www.w3.org to modernize the markup and reduce the unnecessary clutter.
“By default DW gives you horrible bloated code and by the time you have cleaned it up you might as well have just written it yourself in the first place.”
You’re talking about Frontpage, right?
If you’re a developer, editors like Eclipse (or BBEdit if you insist) sure are perfect, now for website design, even coupled with development, Dreamweaver is the right choice, the ability to switch to “design mode” is priceless. And as it has been said, it has a powerful Find / Replace tool, with Regular Expression if you want, an FTP module, you can even upload to the server (testing or remote) each time you save the document, and CSS-editing is so easy. A nice thing too is that when it detects a php function, it colors it blue, so you know you didn’t make any mistake.