Friday, February 20, 2009

Google Hack

What's the most published language in the whole wide world?

I'm guessing that the answer once was "English" but now it's "HTML"... more HTML text is produced and reproduced and passed from place to place than text written in any other language.

Maybe I'm wrong... but the proof, one way or another, isn't easy to come by... it ain't obvious.

So it comes as no surprise that lots of people can read, and sometimes write, HTML with varying degrees of fluency. Just like any other language.

Like me. I can read it pretty well, and write it well enough to be understood. Like longshoremen from Bangladesh and Bosnia, standing on a dock in Egypt, conversing in fractured English... I speak fractured HTML.

And write a little bit, like this snippet I just added to this blog:
   <style>
#main-wrapper { width: 50% }
#sidebar-wrapper { width: 339px }
</style>
It fixes a problem that's been bothering me for a couple of days: The wonderful "US Weather Radar" gadget (look over to the right) was getting cut off when the browser window was resized to be narrow.

In fact, on any monitor less than 1440 pixels wide, it was cut off even if the browser window was maximized!

Now, I didn't write the HTML for this blog. It uses one of the "Minima Stretch" templates created by Douglas Bowman (I'd provide a link if I could remember where I got it from :)

I didn't write the HTML for the US Weather Radar gadget, either. That came from here.

I'm not even brave enough to edit the template, not yet at least.

But I am brave enough to read it, and find out that the "main-wrapper" and "sidebar-wrapper" widths were set to 67% and 25% respectively... and 25% wasn't really wide enough to display the US Weather Radar gadget on anything but really wiiiiide displays.

So, first of all, I captured a screen shot of the gadget into the classic Paint Shop Pro and determined that 339 pixels was wide enough.

Then I got brave, and pasted this HTML snippet just ahead of the HTML for the gadget, as a style override (easy to pull out if everything explodes):
   <style>
#sidebar-wrapper { width: 339px }
</style>
That sort of worked... now you could see all of the gadget all of the time, but sometimes the entire sidebar was pushed wayyyyyy down to the bottom of the page. The 67% was clearly causing trouble... it was insisting that the main column was always supposed to receive 67% of the total width, and if the 339 pixels didn't fit in the remaining width it got pushed down below the main column.

I won't go into the other (failed) attempts to solve THAT problem... the 50% setting seems to be a workable alternative. You can still see the "all the way to the bottom" behavior if you make the window really narrow.

And that's why it's called a "hack".

No comments:

Post a Comment