How do you resize an image so that it fits inside a fixed size container while maintaining its aspect ratio? The apparent solution is to set the image width, height, min-width and/or min-height to 100% or auto. However, this solution is not generic enough to handle images with varying aspect ratios properly. Here is an example:
November 18, 2014
April 29, 2013
Printing Wide HTML Tables
I built a report using HTML table that had more than two dozen columns. In fact, it was a matrix report where the number of rows and columns could grow indefinitely. The report looked perfect on the screen. However, upon printing, the browsers would print only the left portion of the table while the portion which does not fit on the page horizontally is discarded.
I was not able to find a solution so I made a half-hearted attempt at this. My "solution":
- Create a fixed width div with hidden overflow
- Place a copy of the table inside this div
- Scroll the desired portion of the table into view using CSS positioning
- Repeat as many times necessary
January 24, 2011
Multiple Submit Buttons: Changing Order of Default Button
When a form contains more than one submit button, the name-value pair submitted by the browser is that of the button that was activated (via click for example). But what happens if you press "Enter" to submit the form? The answer is simple: the name-value pair submitted by the browser is that of the first submit button that appears in the source.
October 27, 2008
Multiple Submit Buttons on HTML Forms: Alternate Methods
HTML forms often need to present a choice between two or more operations on the same data. Here is an example:
[x] User 1 [ ] User 2 [x] User 3 [ De-activate selected user(s) ] [ Permanently delete selected user(s) ]
In this article, I will outline few examples to accomplish this. All of the following examples refer to a field called "command" which specifies the operation to perform. Assume that the "verbosity" on the captions is required.
