www.webdeveloper.com
Results 1 to 10 of 10

Thread: Is this a clean code / best practice?

  1. #1
    Join Date
    May 2006
    Posts
    135

    Is this a clean code / best practice?

    Hi everyone. I just wanted a second opinion on whether or not my code conforms to best practices and such. Please take a look at this page and let me know if there's anything you would change or if there is a simpler solution especially in regard to the CSS.

    Here's a link to the page.
    www.mark-yieh.com/anneSharp/speaking.html

    Thank you for your input.
    Last edited by mark_yieh; 07-12-2006 at 02:32 AM.

  2. #2
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    There's a lot of non-semantic (presentational) markup in the body and a syntax error in a meta tag. It's quite readable with CSS disabled, though, so that's a good thing.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  3. #3
    Join Date
    Apr 2003
    Location
    Rosemount, MN
    Posts
    2,287
    This is just personal prefference, but I like to write my css code vertically instead of horizontally if that makes sense. For me it seems easier to read.
    Example:
    You:
    Code:
    .content {font-family: arial; text-align: justify; width: 525px; position: relative; top: -415px; left: 175px;}
    Me:
    Code:
    .content 
          {
          font-family: arial; 
          text-align: justify; 
          width: 525px;
          position: relative; 
          top: -415px; 
          left: 175px;
          }
    BTW -- Some Tips
    - When you specify a font-family, it is best to have more than one font listed.
    - You don't need to add px after a 0 this makes your file size a little smaller, but not much.

    - Otherwise you CSS looks Good.
    My settings

    Browser :: FireFox 1.5
    Resolution :: 1152x864
    Connection :: Cable Modem 2Mbs

  4. #4
    Join Date
    May 2006
    Posts
    135
    there is only one meta tag in the document and i can't find what's wrong with it.

  5. #5
    Join Date
    Dec 2005
    Location
    American, living in Toronto, ON. CANADA
    Posts
    6,746
    Quote Originally Posted by mark_yieh
    there is only one meta tag in the document and i can't find what's wrong with it.

    <meta http-equiv="content-type" content="text/html; charset="ISO-8895-1" />

    content="text/html"; perhaps? I'm not quite sure what is wrong here, either..

  6. #6
    Join Date
    Dec 2005
    Location
    American, living in Toronto, ON. CANADA
    Posts
    6,746
    Quote Originally Posted by The Little Guy
    This is just personal preference, but I like to write my css code vertically instead of horizontally ....
    You know, -I've read about that somewhere. -Ettiquette for posting in Forums, to make your code 'vertical' for ease of eye-strain. Yet, *I* find that annoying. I prefer my coding 'horizontal', with NO horizontal scroll-bar, of course.
    That, and absolute URLs. Not "< img src ="/images/this.jpg" />" but < img src =" h t t p//w w w(dot)mysite(dot)com/images/this.jpg" />. That way we can lift the code and use it offline (sort-of) on editing software and (with internet-access) get all the images intact, present and accounted for.
    This is the first thing I do when working with someone's code... is to get the URLs absolute so I can use it in editing software. I often end up 'horizontalizing' their code for my own benefit with the understanding that they will 'verticalize' it back again...

  7. #7
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  8. #8
    Join Date
    May 2006
    Posts
    135
    does the capitalization in the meta tag make a difference? I'm looking at a book "The Complete Reference HTML & XHTML fourth edition" by Thomas Powell and his examples show

    <meta http-equiv="content-type" content="text/html; charset=ISO-8895-1" />

    That, and absolute URLs. Not "< img src ="/images/this.jpg" />" but < img src =" h t t p//w w w(dot)mysite(dot)com/images/this.jpg" />. That way we can lift the code and use it offline (sort-of) on editing software and (with internet-access) get all the images intact, present and accounted for.
    thank you for this tip WebJoel. It makes sense. I'm going to use this method from now on.

  9. #9
    Join Date
    Dec 2005
    Location
    American, living in Toronto, ON. CANADA
    Posts
    6,746
    I'm not sure if capitalization makes a difference or not, but I know that lower-case always does not make a differance. I usually just use lowercase, but I have an editing tool that creates a working template that includes upper & lowercase letters. I usually just leave it alone (I merely assume that it is correct).

    Oh yes, -Ray, -yeah! That meta-tag thing... you're right. I looked at that and it was so obvious after seeing the way you wrote it. I don't write too many meta-tags... I just let the html-editor do it and that is one of my weaknesses I guess.

  10. #10
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    Actually Fx/Tidy showed me that extraneous quote.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles