6 replies [Last post]
rene
rene's picture
User offline. Last seen 1 year 47 weeks ago. Offline
rank Regular
Regular
Timezone: GMT-10
Joined: 2010-02-16
Posts: 17
Points: 31

Hi,

Is there a way to more easily clean up my code so that the open and closing divs, tags, etc. line up appropriately? My code gets so messy and I have a hard time reading or finding errors.

René

Deuce
Deuce's picture
User offline. Last seen 3 days 1 hour ago. Offline
rank Guru
Guru
Timezone: GMT-6
Joined: 2005-11-20
Posts: 4416
Points: 1835

You can check out

You can check out HTMLTidy.
It won't write good code for you, but it will make your code validate.
Sometimes it's an okay option, your best bet is to code carefully and validate along the way instead of waiting until the end.

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

Hugo
Hugo's picture
User offline. Last seen 17 hours 57 min ago. Offline
rank Moderator
Moderator
Joined: 2004-06-06
Posts: 15095
Points: 2190

Tidy will re-format your code

Tidy will re-format your code for you, snaking it, but you should learn to write human readable code yourself; of course work with heavy dynamic sites and it's a lost cause Smile

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

rene
rene's picture
User offline. Last seen 1 year 47 weeks ago. Offline
rank Regular
Regular
Timezone: GMT-10
Joined: 2010-02-16
Posts: 17
Points: 31

"Snaking" ...that's the term!

"Snaking" ...that's the term! Smile Yes, I do like and try to write it so 'me' (aka human) can read. But this is some of my earlier sudden steep learning curve code writing from a frantic desperate race for layout deadlines for a project pitch. My time right now is not allowing for tedious clean-up of so many pages. But my newer pages are looking pretty snake-spiffy!

Back to my problem: HTML Tidy is not downloading (for me and others). Any other options?

René

rene
rene's picture
User offline. Last seen 1 year 47 weeks ago. Offline
rank Regular
Regular
Timezone: GMT-10
Joined: 2010-02-16
Posts: 17
Points: 31

Validate along the way

Thank you for that tip! I am going to be applying that.

René

Deuce
Deuce's picture
User offline. Last seen 3 days 1 hour ago. Offline
rank Guru
Guru
Timezone: GMT-6
Joined: 2005-11-20
Posts: 4416
Points: 1835

You don't have to download

You don't have to download it, you can use an online version.
http://infohound.net/tidy/

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

Hugo
Hugo's picture
User offline. Last seen 17 hours 57 min ago. Offline
rank Moderator
Moderator
Joined: 2004-06-06
Posts: 15095
Points: 2190

Or even better simply use

Or even better simply use Firefox with html validator extension which is Tidy and has an option to 'Clean up Code' new window nicely formatted / indented code

Here's the forum tidied

</div>
<div class="forum-post-panel-main clear-block">
<h3 class="post-title">"Snaking" ...that's the term!</h3>
 
<div class="content">
<p>"Snaking" ...that's the term! <img src=
"http://csscreator.com/sites/all/modules/smileys/packs/Roving/smile.png"
title="Smile" alt="Smile" class="smiley-content"> Yes, I do like
and try to write it so 'me' (aka human) can read. But this is some
of my earlier sudden steep learning curve code writing from a
frantic desperate race for layout deadlines for a project pitch. My
time right now is not allowing for tedious clean-up of so many
pages. But my newer pages are looking pretty snake-spiffy!</p>
<p>Back to my problem: HTML Tidy is not downloading (for me and
others). Any other options?</p>
<p>René</p>
</div>
</div>
</div>
<div class="forum-post-footer clear-block">
<div class="forum-jump-links"><a href="#top" title=

Hmm not snaking though! Used to Puzzled

Ok does Smile

                 <div class="reply-count">
                    5 replies [<a href=
                    "/topic/cleaning-code#comment-161091" class=
                    "active">3 new</a>] [<a href=
                    "/topic/cleaning-code#comment-161097" class=
                    "active">Last post</a>]
                  </div>
 
                </div>
                <div id="node-39426" class=
                "top-post forum-post clear-block">
                  <div class="post-info clear-block">
                    <div class="posted-on">
                      Fri, 2010-03-12 17:03
                    </div>
                  </div>
                  <div class="forum-post-wrapper">
                    <div class="forum-post-panel-sub">
 
                      <div class="author-pane" author="61058">
                        <div class="author-pane-inner">
                          <div class=
                          "author-pane-name-status author-pane-section">
                          <div class=
                          "author-pane-line author-name">
                              <a href="/users/rene" title=
                              "View user profile.">rene</a>
                            </div>
                            <div class="picture">
                              <a href="/users/rene" title=
                              "View user profile."><img src=
                              "http://www.gravatar.com/avatar/70d2f6e357ec61141a0f70a8f8bcd069?d=http%3A%

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me