SyntaxHighlighter

Monday, June 12, 2006

Maxwidth, Minwidth

To set the maximum width and minimum width of a block item, you can do a combination of things. Mozilla understands "max-width" and "min-width" css rules. Unfortunately, IE does not, but IE does give you another, very powerful option. Expressions in CSS allow you to do all sorts of things with javascript, the dom, and css styles.

Here's how one would set the width of an element in the page.

.mainwidth{
max-width:1024px;
min-width:800px;
width:expression(document.body.clientWidth > 1024? "1024px": (document.body.clientWidth < 800? "790px" : "auto")) };

Note - I had to set the size to be a few pixels larger than the campared width (800px). Otherwise, IE would crash.


Looking online, this is apparently due to a missing doctype declaration. My page was set to:

http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd

It was not immediately obvious why this error would occur, but it was not enough to warrent greater investigation at this time.

After adding this to the style sheet, the user can resize the page. The items in the page will hold their minimum and maximum widths appropriately.

This was checked on IE6 and Mozilla 1.5.

Sunday, June 04, 2006

Starting with Ruby

I started messing around with Ruby a few weeks ago to learn more about the technology. I now have about 30 hours of experience and am sold on it. A person can accomplish a lot with Ruby in a short time. It seems to be ideal for the front-end developer, as more back-end coding is easier to handle - such as creating the database model, or writing the business logic.

Having a background in jsp, spring framework, MVC frameworks, and ajax helps give some understanding to the conventions used in Ruby and Rails.

Looking forward to doing more.