So, we’re finally getting to the meat of best practice web development. This is what people are usually thinking of when they ask about best practices in web design or web programming: actually building the web site itself.
Web design best practices encompass a wide range of needs — everything from the visual look of the design and use of well-chosen markup to the implementation of alternate styles for mobile devices or print shows up in this area. Covering it in one article is, perhaps, ambitious. Fortunately, I’ve written on parts of this subject frequently in the past, so I’ll be providing a lot of links.
It’s important for best practices to clearly separate the structure of your web design (the internal labeling and definition of page elements) from the design elements (the appearance of these elements.) In the last article in this series, I discussed a few key elements of design: not in terms of color, layout, or typography, but in terms of communicating information.
Best practices ultimately leads to creating a universal or accessible design, and this practice hinges on two key concepts: web semantics and the separation of your structure from your design.
The Semantics of HTML (HyperText Markup Language)
You can argue for days (or years, if you take look at the search results for “html semantics” or “web semantics”) on the detailed semantics of how HTML tags should be used. I’ve written on this several times, myself, including articles discussing the value of empty elements, the age-old debate between table-based or CSS (Cascading Style Sheets) layout, among many others.
Semantics are very important. However, when you really look closely at HTML you’ll inevitably notice that it’s not a strongly semantic language — the mark-up language doesn’t even come close to describing all possible uses of the tags. Many tags end up inevitably serving multiple functions.
So what web semantics really require is interpretation. The HTML specification provides one version of this interpretation, with suggested uses and meanings for elements. I’ve provided my own interpretation, as well. There are without question differences of opinion between those documents.
Obviously, you can argue very convincingly that any interpretation which disagrees explicitly with the HTML 4 specification is wrong. Feel free. The core of best practices in web semantics is to use them and make decisions: it’s about thinking, not specific rigor.
We need to differentiate, however, between the semantics of HTML and web semantics. The semantics of HTML are specific and defined: meaning as applied to the elements of HTML. This is a finite list of items, although the complete definition of meaning is less so. Web semantics, on the other hand, describe the application of meaning on the web. This is a more global concept, and applies to all aspects of your web development process.
Web semantics includes everything used to add meaning to your site, providing better comprehension of code and content. Using describe class and ID naming conventions, descriptive function names in server or client-side scripting, or providing helpful comments within your code can all be considered points of web semantics. Best practices means providing a site which is meaningful in both the front and back end.
For specific suggestions about element use, refer to my guide to semantic HTML.
Separation of Structure from Design
This is such an old question to harp on, but the importance of separating the organization of your page from the way it looks has never really flagged.
At a superficial level, it may appear that any markup you use has an effect on the appearance of your site. After all, there’s a clear visual difference between unstyled text marked as a heading and unstyled text marked as a blockquote! However, this visual difference only truly exists because the description “unstyled” is truly a misnomer.
If you disable stylesheets on a web site, you’ll see an extremely plain view of the site. It is not precisely “unstyled,” however — the design has simply been reduced to the default styles applied by the browser. In general, every browser has very similar defaults — but they’re not exactly the same. This is one of the reasons that it’s common to begin a stylesheet with a set of reset styles.
If you conscientiously remove the browser default styling, it can make your own development easier: the slight differences between browsers can then be ignored.
The point is that you should never place anything in your markup which exists purely to create a different appearance. Attributes or tags which define font faces, colors, or styles are obvious problems — but the use of small
or strong
can also be problems. It’s not that you should never use small
: but your use of the element shouldn’t depend on the text being rendered smaller than the surrounding text.
It might not happen, after all.
This is one of the key complaints about using tables for design layout. A table is designed to organize information by providing easy access to it in a matrix. The columns and rows visual appearance of a table is a formality used because it is an expected way to view this type of data organization.
When you take a table and use it to layout your design, you are violating the separation of structure from appearance: your design is now dependent on the default organization of tables. Should somebody attempt to re-organize your table (for example, to linearize the information,) they may encounter a radically illogical data structure.
Fundamentals of Universal Design for the Web
The goal of universal design is very simple: make the information in your website available to every person or device which attempts to access it. This includes mobile devices, search engines, assistive technology, disabled users, and standard desktop browsers.
Universal design is where we bring everything above together. Attention to web semantics and a strong separation between structure and design give your web site at least a fighting chance of being universally usable. Obviously, you can still screw things up!
In the same way that following web standards doesn’t mean that you’ve made a web site accessible, following best practices for general web development doesn’t mean that you’ve made a site which will be great on a hand-held device or with a screen reader.
Different devices (like people) have different special needs.
Creating a web site which is truly universal requires you to be aware of the special needs of every device you’re working for — but a few basic principles will get you 95% of the way there.
The Principles of Universal Design provided by The Center for Universal Design at North Carolina State University are a good guideline for thinking about universal design. Although these principles are truly designed to be universal, in that they are intended to be applied well outside the realm of web development, the basic principles are sound in any context.
If you break the concept of universal design down to a single core issue, it could be that dependencies break access. Whenever you set up a situation in which a specific technical or design element must be present (a dependency on Javascript, a requirement that a control matches the description provided, or a requirement that a user must see a given image, for example,) then you are creating the potential for design failure. Avoid creating anything which depends anything out of your control.
Knowing what is and isn’t in your control (and, more importantly, what seems like it’s in your control, but really isn’t) is critical to best practices in web development. Acknowledging that although you can set the color of the text, you can neither guarantee that a visitor will be capable of seeing that color nor that the text will in fact be that color at the point that a visitor sees it is a critical step in understanding universal design.
Best Practices in Web Development: Part 5 (published on Friday, September 5th) covers interaction design, error management, and long-term site administration.
Taina P.
This is a truly enlightening discussion of web design and web development. Even though I’ve been designing for so many years now, I’ve never had taken the time to look and think these things through. Reading about the semantics of HTML (HyperText Markup Language), structure, functionality and stuff have given me deeper understanding of what and what not to do when designing.
I should study more regarding Universal Design. Thanks for this! I’ll be checking out the earlier parts.
Jason Grant
Good points made especially on the matter of building in dependencies, which one cannot really count upon.
I am writing on a similar topic of Semantic User Interfaces – The Best Practices, so please feel free to let me know if you want me to link to you.
Gaming YouTube
I think all too often web designers are a little too narrow minded about the design of their site, and forget to take into account the user experience from the perspective from someone who has never been to your site before and knows nothing about it. Sometimes it’s hard to get that perspective.
Joe Dolson
But I wouldn’t view those as design elements – a paragraph is structural, indicating a break in the continuing flow of the text. You may be hoping for
em
to generate italicized text, but you haven’t specified that you want italics: simply that you want emphasis. That, again, is a structural indication — the use of italics to represent it is a separate issue.These elements both have a function outside of the visual design representation: they provide information for other user-agents to help communicate the information more effectively.
That’s part of the illusion of design: people frequently believe that they’re adding paragraph tags (or emphasis, etc.) in order to create a visually separated block of text, when actually the purpose of the element is to create a paragraph, regardless of the visual presentation of that text. It’s still machine-readable as a paragraph even if the designer has (foolishly) chosen to collapse the margins and padding on all paragraphs. The visual designer has broken the paradigm of a paragraph for visual users, but screen readers will still gain the benefit.
Thanks for your comments, Jennifer!
Jennifer Kyrnin
Great article. I’m still not convinced that it’s 100% possible to separate content from design. Granted, you said “separate structure from design”, but I’m not convinced that’s really possible either. I agree it’s something good to strive for, but ultimately impossible.
Why? Because whenever you try to get someone to post content sans design elements, they can’t. For example, even here, I’ve added paragraph spaces (assuming they show up in the comment), em tags for emphasis which I’m hoping will show up as italics, and so on.
When I worked as a CMS (Content Management System) designer, I was always striving to find the “perfect” input form. This would be the form that was easy to use, but took all the design away from the writers. In one horrible iteration, we had an article form that was built one paragraph at a time. And my content authors would paste in entire Word docs into the first paragraph field. When we explained they had to do it paragraph by paragraph, they rebelled. So in that instance, we had created a fully separated content/design system. But the people involved wouldn’t use it.
Joe Dolson
Depends on what you mean by “pre-built systems.” There’s nothing inherently wrong with using a CMS (Content Management System), if that’s what you mean – you simply need to be prepared to work on the output code and make sure that you’re giving the end-user what you intend.
The use of freely-available themes (such as with WordPress) does lead to a lot of low-quality code — but the greater concern is professionals who aren’t paying close attention to what they send out.
neil
when it comes to actually building the website i find a lot of people use pre built systems. this is poor quality in my opinion