You are here: Re: Forms in table cells modify cell height - grrr « HTML « IT news, forums, messages
Re: Forms in table cells modify cell height - grrr

Posted by Tim Streater on 07/06/07 23:45

In article <slrnf8tj98.sl3.spamspam@bowser.marioworld>,
Ben C <spamspam@spam.eggs> wrote:

> On 2007-07-06, Tim Streater <timstreater@waitrose.com> wrote:
> > I post an example here which is giving me ulcers. I've cut it down to
> > the minimum possible to illustrate the problem.
> >
> > There are two tables. In the first, the rows with the buttons render
> > with extra space at the bottom of the cell, below the text area and the
> > button. Why is this space there and how do I get rid of it? I sort of
> > succeed in this with the second table, but I have to delete the </form>s
> > to achieve it.
>
> Please, no!

:-)

Hey, I didn't say I was *happy* about that. That was just the result of
some experimenting.

> Common sense should tell you that if you are deliberately making the
> HTML invalid then you are going in the wrong direction.

Yes. I gave up testing at that point and sought help. This came up
because I have a page with a list of open trouble tickets displayed,
where our NOC hasn't recently updated them. Many of these are for future
network maintenance and so it would be nice to flag them in the database
so they don't show. The list is just a table and I added a cell in each
row containing a form with a button to submit the form - and BOOM!
suddenly each row was rather taller. A bit ugly.

> > Under OS X, Safari and Firefox give me the extra space in every row of
> > the first table, Safari gives none in the second while Firefox only
> > gives none for buttons 5 and 6. IE renders both tables identically.
>
> Firefox in quirks mode gives form a bottom margin of about 0.5em.
>
> You can fix your problem in two ways, of which you should do at least
> the second and possibly both:
>
> form { margin: 0 }
>
> in the styles
>
> or use the strict mode doctype, i.e. put this right at the top of every
> document:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/REC-html40/strict.dtd">

I'll look into that. Some of my pages may have that but almost certainly
not all.

> Do that anyway-- if you don't you get quirks mode, which is full of
> annoying and surprising quirks like that bottom margin on forms. You
> might call it ulcers mode.
>
> I saw this problem on some of the admin pages that my embedded
> router/modem thing produces. The author of those had "solved" the
> problem by applying a top margin of -15px to the next element in the
> document!
>
> Even worse someone suggested on one of these NGs the other day "fixing"
> the same problem by using broken form/table structure. It seems you were
> starting to circle the same drain. I wonder how many of the broken
> forms/tables I see every day on the web are caused by people trying
> anything to make that bottom margin go away.

OK. So are you saying that I shouldn't put a <form> inside a table cell?
I want to have an action button in my table row. I want to have valid
html though, as in my experience hacks will bite you sooner or later. I
made each cell have its own form, because I couldn't find in any of the
docs I have whether a form can be submitted by any one of several
buttons. All the examples I ever saw only had one button, and the docs
didn't appear to cover the point.

Thanks for your help.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация