The Problem
While working on a new page for a client this morning I discovered that relative positioning doesn’t work for td elements in Firefox. The page required a three column grid of products and on the bottom of each product cell would be a “buy” link. So, logically I decided I needed to do the following:
- set
position: relative on the td for product grid
- set
position: absolute and bottom: 0 on the “buy” link
It worked in Safari, Chrome and even IE. But failed in Firefox to my dismay – the “buy” link appeared outside the cell it should have been in, along the edge of the browser window. A quick Google search showed that it’s a known issue.
The Solution
Here’s my solution to the problem:
- wrap the contents of the
td in a div
- set
position: relative and height: 100% on that div
The Example
Here’s a web page with examples of the problem and the solution.
Update:
It seems this solution has issues when cells in the table row have varying heights. I’ll need to spend some time experimenting.
Creating text file attachments for email is a programming skill that’s simple but very useful to know. If you need a simple way to share or export data from your app this is as easy as they come.
First, start by creating a string with the contents of the text file that will be attached to the email.
|
|
NSString *textFileContentsString = @"some data, some more data, yet more data"; |
Your text file doesn’t have to be as simple as this. It could be something more substantial, like a CSV or an XML file.
Next, convert the string to data.
|
|
NSData *textFileContentsData = [textFileContentsString dataUsingEncoding:NSASCIIStringEncoding]; |
And then create the MailComposeViewController and add the attachment data.
|
|
MFMailComposeViewController *mailComposeViewController = [[MFMailComposeViewController alloc] init];
mailComposeViewController.mailComposeDelegate = self;
[mailComposeViewController setSubject:@"Data Export"];
[mailComposeViewController setMessageBody:@"Here's the data that I am exporting" isHTML:NO];
[mailComposeViewController addAttachmentData:textFileContentsData mimeType:@"text/plain" fileName:@"data.txt"];
[self presentModalViewController:mailComposeViewController animated:YES];
[mailComposeViewController release]; |
That’s should be enough to demonstrate how it works. I won’t go through the details of using a MFMailComposeViewController. You can read about it at the Apple Developer website.
If you want to Google search for something on a specific website you should add site: followed by the domain of the website you want to restrict the search to. For example if you want to search for UISearchDisplayController, but only in Apple’s Developer website enter you would enter the following:
UISearchDisplayController site:developer.apple.com
This can come in handy as Google very often can be better at finding things in a website than the search provided by the website.
I’ve upgraded to Lion and I’m loving it so far. It takes some adjustment, but making the effort to learn all the new gestures and understand how to use Mission Control effectively pays off.
If you just installed Lion and haven’t already, you should study all the new gestures in System Preferences under Mouse and Trackpad. Gestures are much easier and fun to learn than old school keyboard shortcuts.
I also recommend checking out the help documentation for Mission Control. You can find it clicking the “?” button in the bottom right of System Preferences/Mission Control.
I just realised I’ve been neglecting to post about app updates lately.
FontView 1.4.1 is out. 1.5 is waiting for review. It will have a new icon and launch screen as well as an In-App Purchase to disable ads.
Webstock 1.1 is out. I’ve added buttons to session views to take you to the corresponding video page on the Webstock site. Videos should be AirPlay compatible.