Re: Netscape and and tables

by "rudy limeback" <r937(at)interlog.com>

 Date:  Sat, 10 Jun 2000 21:34:39 -0400
 To:  "Susan Walsh" <SusanW(at)inscodico.com>,
<hwg-techniques(at)hwg.org>
  todo: View Thread, Original
>Does anyone know any tips that may be of help?

hi susan

yes i have a simple one

st�phane, who said "put all the code for the offending cell on one line
with no spaces between tags and no hard returns" may be interested in this
too

netscape will definitely insert white space into a table cell that is coded
like this

    <td>
        <img src=foo.gif>
    </td>

however, to avoid this problem, you do not have to code everything all one
one line -- just remove the line break and tab that are between the closing
">" of the img tag and the opening "<" of the /td tag

naturally, most people think this implies you have to code it all on one
very long line, but it doesn't

lemme tellya, those long lines of code are a real pain if you're trying to
read the actual code, to say nothing of what it's like to maintain or even
understand code that's written like that

back and forth, back and forth, horizontallly scrolling text is extremely
user-hostile -- and in most cases the user is gonna be yourself, you will
*hate* reading code like that

by the time i've scrolled sideways two or three screens full of text, i
often forget where i am (on which line of code) and what i was looking for
anyhow -- but that could be just my oldtimer's disease, i guess

of course, if you're using a wysiwyg editor, there's a good chance you
don't care what kind of code you get -- no flames, please, i do realize
that some very competent code jockeys use dreamweaver...  well, maybe just
to get a page started...  ;o)

[aside: dreamweaver's actually pretty darned good, there's another product
that shall remain nameless that should really be called wygiwyd -- what you
get is what you deserve]

anyhow, to make a long story short -- i know, i know, it's already too late
for that -- here's the tip

break the line *inside* a tag

for example

    <td
    ><img src=foo.gif
    ></td>

looks weird, right?  perfectly valid

it's quite clean and neat and more practical -- to me, anyway

you see, in addition to getting completely around the
netscape-inserting-whitespace problem, it has a real advantage for keyboard
jockeys

you can insert extra lines of code real easy, then yank them back out
again, all without having to worry about whether you left a blank or tab or
hard return in a place you shouldn't have left it

for example

    <td
    ><img src=foo.gif
vspace=0
    ></td>

notice how easy it is to stick that in there, and how easy to take it back
out

    <td
  valign=middle
    ><img src=foo.gif
    ></td>

great fun, easy as pie

keyboard jockeys will instantly see the benefit of this technique, because
you can highlight an entire line of text for easy deletion or copy or
insertion simply with the shift and down arrow keys -- no more
ergonomically disastrous moving of your hand off the keyboard and onto the
mouse just to click somewhere inside a long line just to position the
cursor so you can do a ctrl-v at the appropriate spot

what's that? oh, sorry -- i thought even people who use a mouse know about
ctrl-v -- which is the "paste" operation, it uses the pinkie and first
finger of the left hand and you can actually combine it with using the
mouse (if you're right handed)

what's that? why would you ctrl-v?  surely you aren't going all the way up
to the menu bar with the cursor, just to click on edit and then click on
paste? can you say tired wrist and sore arm? heck, i don't even have to
look at the keyboard (any more) to use ctrl-v -- or alt-tab, for that
matter, which has *got* to be the fastest you can possibly switch
windows....  ever seen a mouse user cut and paste repetitively from one
window into another?  gives me the shudders

but i digress...

anyhow, next time you're coding, stick a newline-space in front of your
greaterthan bracket to close a tag -- give it a try, i'm sure you'll like
it

your code will look neater, it'll certainly be easier to maintain, you'll
never scroll sideways again, you'll keep netscape whitespace away, your
shirts will look brighter, dogs will stop snarling at you, and that cute
guy/gal on the bus just might smile back the next time....

and to be perfectly devilish about it, you could always do a search&replace
after you finish testing a page, and change all newline-space-greaterthan
strings to just greaterthan, post the page on your server, and let the
world read it as one long line

of course, when you open up a page for maintenance, then you'd want to use
search&replace to change every greaterthan to newline-space-greaterthan...
i do this almost all the time anyway when i want to read somebody else's
source code...

i *hate* scrolling sideways

p.s. the greaterthan can also be in column 1, you don't need a space in
front of it, i just find it looks a little nicer with some indenting

no idea why the wysiwyg editors don't do it that way...

_____________
rudy limeback
http://r937.com/
http://evolt.org/

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA