Help - Search - Members - Calendar
Full Version: The Top Html Mistakes
Zymic Webmaster Forums > Web Design & Development > Client Side Scripting > HTML and CSS
Gawdl3y
Hey, all. I put together this list, and maybe it'll help some of you improve your HTML. biggrin.gif Here we go:
  • Not closing Tags
    CODE
    <div>LOL!<br />goes on and on and on w/o closing the <div> with </div>
  • Not Using Self-Closing tags or Closed Tags
    CODE
    <input type="text"><br />
    should be
    <input type="text"></input><br />
    or
    <input type="text" /><br />
  • Using Non-Self-Closing Breaks or Horizontal Rules
    CODE
    <br><hr>
    should be
    <br /><hr />
    BUT NOT
    <br></br><hr></hr> (Deprecated!)
  • Capitalizing element names - Validation Problems
    CODE
    <Br />
  • Using no Doctype
    CODE
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  • Using Deprecated Tags
    CODE
    <i><b><u>Bob</u></b></i>
    should be something like
    <span style="text-decoration:iti;"><strong><span style="font-style:italic;">Bob</span></strong></span>
    (I know, I can combine the Span's, but this is to show the correct replacements...)
    Also, for Bold:
    <span style="font-weight:bold (OR BOLDER OR A NUMBER);">Bob</span>

Well, hopefully you heed these... If you do, you're well on your way to being able to validate with W3's STRICT standards, and be safe from the deprecated stuff. smile.gif
MrTouz
Well its kind of cool but also really bad explained.

For example, the 'br' as <br> works perfectly well and is valid at HTML 4.1 Transitional. So you must NOT only put <br /> or <hr />
Going with this, you should post all different types of Doctypes and not only xhtml 1 strict. because many people do NOT use xHTML yet.

Should be a little more explained...
Gawdl3y
Yeah, I'm terrible at explaining things. >.<
And I guess I'm always stuck to XHTML Strict, lol... I've finally got myself into the habit of not ever using anything deprecated, and such...

And I came up with another one:

People do not comment out Javascript sometimes, which is a no-no for old browsers.
CODE
<script type="text/javascript" language="JavaScript">
document.getElementById('blah').innerHTML = 'blah';
</script>

SHOULD BE

<script type="text/javascript" language="JavaScript"><!--
document.getElementById('blah').innerHTML = 'blah';
//-->
</script>

Or something similar.



Now as for the doctypes, I'm planning on making a separate topic for the list of them all.
Jetteh22
Okay...

I never quite understood the reasoning behind <input type="text" /> or <br /> or <hr />

Not closing those works perfectly fine for me and when doing CSS/XHTML validation it's all valid?

Andrew
Can't be jetteh it's DEFINITELY not xhtml valid. It might be html 4.01 valid but def not xhtml.
MrTouz
nothing can be validated on xHTML if you don't put the weird / tag at the end.
Gawdl3y
Or close it with </.
Bogey
lol the "/" is not weird laugh.gif

Another thing people do is height="#" and those attributes. While that's okay, I prefer ID's and CLASSES

Yet another thing people do is reuse the same ID for numerous elements. While that works, that's not what ID is for. ID is supposed to be a unique element definition and not used for another thing... that is what CLASS is for.
MrTouz
QUOTE
Yet another thing people do is reuse the same ID for numerous elements. While that works, that's not what ID is for. ID is supposed to be a unique element definition and not used for another thing... that is what CLASS is for.


I use to always do this mistake, like everytime... and i always asked my self what was the difference, and about 2 months ago i found out.. and yea, it does not Validate with the w3c Validator so its suggested to set ID's for ONE element and CLASS for elements that are going to be used many times.

good one smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.