| 1. |
Solve : HTML misuse and abuse? |
|
Answer» HTML code misuse, abuse, and ways to correct them. Question A guy looked at my HTML code and told me I was forming bad habits. What is he talking about? Answer All HTML code serves a specific purpose. Everyone with basic KNOWLEDGE of HTML knows that the tag is meant for paragraphs, and the quotes are quotes, etc., etc.. However, it is very easy to misuse and abuse these HTML tags by using them for something other than their intended purpose. Hello. The code that the program generated follows: Code: [Select]<html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 1</title> </head> <body> <p>Hello.</p> <p>This is a sample web page.</p> <p> </p> <p> </p> <p>This is far down...</p> </body> </html> I see several very large problems with this code:
So, where do most people foul-up? Using deprecated tags isn't really a crime, but in the future it will be a tragedy for the Web Designer who uses them. However, I'm talking about people intentionally using tags for something they weren't meant for. Like the following: THE TAG - Everyone knows the tag, right? it is used to specify paragraphs. However, when people want to make multiple lines of blank space, they often use this code block: This is a paragraph with one sentence. You can also use CSS: Code: [Select]p.leading { padding-top: 2em; } Kudos to robpomeroy This is the same as the paragraph abuse, with one major difference: It will render properly on all browsers. Of course, the non-breaking space ( ) was abused there as well. Why? That's not the point of that special character. It is also abused in another way: Indenting. Let's say you want to be fancy and indent a paragraph. How does your standard WYSIWYG editor do? It puts non-breaking spaces in there. So what you got is blank space followed by text. Sounds great, right? Wrong. The problem here is more than shoddy browser support. It doesn't event indent evenly. To prove my point, open Word or Notepad and hit spacebar five times, and type a short sentence. Go down a line, and hit spacebar five times, and type a completely different sentence. Repeat for a few more lines. How it comes out DEPENDS on your font. A mono-spaced font such as courier will show up fine. However, your site isn't courier by default; it's Times New Roman. So what do you get with Times?You might see something like this: See the problem? I "indented" five spaces, and got that shoddy excuse for organization. That's why people use the TAB key on word processing programs; it is always indented the same amount. So what's the real purpose of the non-breaking space? Let's say you work for Widget Incorporated and want to make it so that even when the user resizes their window, the words "Widget Incorporated" never break apart in the word wrap. So, you'd type out Widget Incorporated, and you'll get a blank space that looks like an ordinary space, but will never break. The words will stay together! Neat, isn't it? So how should you indent in a Web Page? With CSS: Code: [Select]p.indent { text-indent: 2cm; } Try this in a long paragraph. Don't hesitate to fiddle with the values. For a tutorial on how to use CSS, please read through QA0014. Though this only covers a couple of the ways that people can misuse tags, there are other ways that people can misuse their code. Empty images is a good example of this. This is used almost as much as empty paragraphs. Question Should I stop using XYZ web development, then? Answer For simple pages made for a small purpose, no. If, however, you intend to take Web Design seriously, it is a good idea to learn HTML and CSS at a minimum. These tools are essential for creating a site that is simple to write, but beautiful at the end. However, WYSIWYG editors don't really have serious problems of abuse - no empty table rows, none of that. Their main problem is deprecated tags. However, I've seen all too many HTML coders abusing the HTML tags just to do a simple thing that could easily be done with the appropriate tag. Note Technically, the META tag is not deprecated. However, Google and other search engines have "pseudo-deprecated" the META tag. This article has more details: http://www.yourhtmlsource.com/promotion/metatags.html This article will be updated periodically with new misuses and abuses. |
|