sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
cookie monster's Avatar

CSS submit button problem


Question posted by: cookie monster (Guest) on July 24th, 2005 12:51 AM
I'm seeing some odd behavior related to CSS and a form, and I'm
wondering if anyone has seen this before and whether they might have a
solution.

I have a small form that is displayed inside a table cell. The tags
are nested like this:

<form><td> ... form elements etc... </td></form>

There are no CSS styles applied to the body, table, table row, form,
or table cell. However, I have applied styles to the individual form
elements.

Specifically, I have applied the following style to the submit button:

.smallbutton {
border : 1px solid Black;
background-color : #CCCCCC;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : xx-small;
font-weight : bold;
}

What I have noticed is that any time I click inside the table cell,
the submit button's border goes from 1px to 2px. If I click outside
the table cell, it goes back to 1. This is only with IE 6.

I would really like to know why it happens and how to prevent it, if
possible. It sure seems weird.


cookie.

13 Answers Posted
Steve Fulton's Avatar
Guest - n/a Posts
#2: Re: CSS submit button problem

cookie monster wrote:
[color=blue]
> I'm seeing some odd behavior related to CSS and a form, and I'm
> wondering if anyone has seen this before and whether they might have a
> solution.
>
> I have a small form that is displayed inside a table cell. The tags
> are nested like this:
>
> <form><td> ... form elements etc... </td></form>[/color]

Oh dear! If this is your actual markup, it's invalid. TR elements can
contain only TH and TD elements, not FORM elements. Of course, since
you didn't provide a URL, we don't know what your markup really looks
like, or if something you didn't share with us is the real cause of
the problem.
[color=blue]
> I would really like to know why it happens and how to prevent it, if
> possible. It sure seems weird.[/color]

Without a URL, we can only go by the snippets (possibly incorrectly
transcribed) that you provided. Validate your HTML and your CSS.
Correct any errors discovered. If the problem persists, post a URL
to the actual page so we can examine your markup in situ.

--
Steve

If men could regard the events of their own lives with more open minds,
they would frequently discover that they did not really desire the
things they failed to obtain. -Emile Herzog
cookie monster's Avatar
cookie monster July 24th, 2005 12:51 AM
Guest - n/a Posts
#3: Re: CSS submit button problem

This is the HTML, very simple in the end:

<form action="test" method="post" name="testform" id="testform">
<table cellspacing="2" cellpadding="2" border="0" width="25%"
class="formtable">
<tr>
<td class="formHead" colspan="2">TESTFORM</td>
</tr>
<tr class="formline">
<td>button 1</td>
<td><input type="submit" name="ok1" value="ok1"
class="submit"
onMouseover="classChange('mouseover',this)"
onMouseout="classChange('submit',this)"
onClick="classChange('click',this)"
tabindex="1" /></td>
</tr>
</table>
</form>


The CSS:

/* style for form submit buttons */
input.submit {
background-color: #FFFFFF;
border: 2px solid;
border-color:#199B37;
color : #199B37;
font-weight: bold;
font-family : Arial, Verdana, Helvetica, Sans-Serife;
font-size: 9pt;
text-align : center;
cursor:pointer;
}


Cheers,
Cookie


On Thu, 17 Mar 2005 07:23:56 -0500, "Steve Fulton"
<cerberus40@hotmail.com> wrote:
[color=blue]
>cookie monster wrote:
>[color=green]
>> I'm seeing some odd behavior related to CSS and a form, and I'm
>> wondering if anyone has seen this before and whether they might have a
>> solution.
>>
>> I have a small form that is displayed inside a table cell. The tags
>> are nested like this:
>>
>> <form><td> ... form elements etc... </td></form>[/color]
>
>Oh dear! If this is your actual markup, it's invalid. TR elements can
>contain only TH and TD elements, not FORM elements. Of course, since
>you didn't provide a URL, we don't know what your markup really looks
>like, or if something you didn't share with us is the real cause of
>the problem.
>[color=green]
>> I would really like to know why it happens and how to prevent it, if
>> possible. It sure seems weird.[/color]
>
>Without a URL, we can only go by the snippets (possibly incorrectly
>transcribed) that you provided. Validate your HTML and your CSS.
>Correct any errors discovered. If the problem persists, post a URL
>to the actual page so we can examine your markup in situ.[/color]

me's Avatar
Guest - n/a Posts
#4: Re: CSS submit button problem

"cookie monster" <nospam@nowhere.com> wrote in message
news:n65j31totts107d9sajmqf7kncd4l5uf5r@4ax.com... [color=blue]
> This is the HTML, very simple in the end:
>
> <form action="test" method="post" name="testform" id="testform">
> <table cellspacing="2" cellpadding="2" border="0" width="25%"
> class="formtable">
> <tr>
> <td class="formHead" colspan="2">TESTFORM</td>
> </tr>
> <tr class="formline">
> <td>button 1</td>
> <td><input type="submit" name="ok1" value="ok1"
> class="submit"
> onMouseover="classChange('mouseover',this)"
> onMouseout="classChange('submit',this)"
> onClick="classChange('click',this)"
> tabindex="1" /></td>
> </tr>
> </table>
> </form>
>
>
> The CSS:
>
> /* style for form submit buttons */
> input.submit {
> background-color: #FFFFFF;
> border: 2px solid;
> border-color:#199B37;
> color : #199B37;
> font-weight: bold;
> font-family : Arial, Verdana, Helvetica, Sans-Serife;
> font-size: 9pt;
> text-align : center;
> cursor:pointer;
> }
>
>
> Cheers,
> Cookie[/color]

For starters the table is busted. Note: colspan=2 below:
Good Luck,
me

<form method="post" action="">
<table width="25%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td colspan="2">TESTFORM</td>
</tr>
<tr>
<td>button 1</td>
<td>
<input type="submit" name="ok1" value="ok1">
</td>
</tr>
</table>
</form>


me's Avatar
Guest - n/a Posts
#5: Re: CSS submit button problem

"cookie monster" <nospam@nowhere.com> wrote in message
news:n65j31totts107d9sajmqf7kncd4l5uf5r@4ax.com... [color=blue]
> This is the HTML, very simple in the end:
>
> <form action="test" method="post" name="testform" id="testform">
> <table cellspacing="2" cellpadding="2" border="0" width="25%"
> class="formtable">
> <tr>
> <td class="formHead" colspan="2">TESTFORM</td>
> </tr>
> <tr class="formline">
> <td>button 1</td>
> <td><input type="submit" name="ok1" value="ok1"
> class="submit"
> onMouseover="classChange('mouseover',this)"
> onMouseout="classChange('submit',this)"
> onClick="classChange('click',this)"
> tabindex="1" /></td>
> </tr>
> </table>
> </form>
>
>
> The CSS:
>
> /* style for form submit buttons */
> input.submit {
> background-color: #FFFFFF;
> border: 2px solid;
> border-color:#199B37;
> color : #199B37;
> font-weight: bold;
> font-family : Arial, Verdana, Helvetica, Sans-Serife;
> font-size: 9pt;
> text-align : center;
> cursor:pointer;
> }
>
>
> Cheers,
> Cookie[/color]

Note that style class names must start with a period. See below:
Good Luck,
me

<style type="text/css">
<!--
..submit { background-color: #FFFFFF; border-color: #199B37; border: 2px
#199B37 solid; font-family: Arial, Helvetica, sans-serif; font-weight: bold;
font-size: 9pt}
-->
</style>


Jim Moe's Avatar
Guest - n/a Posts
#6: Re: CSS submit button problem

cookie monster wrote:[color=blue]
>
> What I have noticed is that any time I click inside the table cell,
> the submit button's border goes from 1px to 2px. If I click outside
> the table cell, it goes back to 1. This is only with IE 6.
>
> I would really like to know why it happens and how to prevent it, if
> possible. It sure seems weird.
>[/color]
Without an URL it is difficult to say. My WAG is that windows/IE is
putting a border around the button to indicate that it is selected and has
focus. Make a small test case where the button is not surrounded by a
table so you can better see what's happening.

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
David Dorward's Avatar
David Dorward July 24th, 2005 12:52 AM
Guest - n/a Posts
#7: Re: CSS submit button problem

me wrote:
[color=blue][color=green]
>> input.submit {[/color][/color]
[color=blue]
> Note that style class names must start with a period. See below:[/color]

No, class names should avoid starting with a period, otherwise you have to
escape them in the style sheet, and that quickly gets messy.

In a style sheet, the class selector starts with a period character - but
the previous poster has done that. He simply combined the class selector
with a type selector which is perfectly allowable under the specification.
(Its worth avoiding since it adds slightly to the processing the browser
has to do, but its not a serious problem).
[color=blue]
> <style type="text/css">
> <!--[/color]

Avoid this cargo cult. Its a waste of time and will cause problems with any
future migration to XHTML.
[color=blue]
> font-size: 9pt}[/color]

It would have been far more useful to pick up on this point though. Point
units are, as has been discussed many times in the history of this group
(and more in the ciwa.stylesheets sister group), entirely unsuitable for
use on screen.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
David Dorward's Avatar
David Dorward July 24th, 2005 12:52 AM
Guest - n/a Posts
#8: Re: CSS submit button problem

me wrote:
[color=blue][color=green]
>> <td class="formHead" colspan="2">TESTFORM</td>[/color][/color]
[color=blue]
> For starters the table is busted. Note: colspan=2 below:[/color]

He already has colspan=2. Although that element should be a caption or at
least a table header cell rather then a table data cell.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
me's Avatar
Guest - n/a Posts
#9: Re: CSS submit button problem

"David Dorward" <dorward@yahoo.com> wrote in message
news:d1cmiq$83h$1$8302bc10@news.demon.co.uk...[color=blue]
> me wrote:
>[color=green][color=darkred]
> >> input.submit {[/color][/color]
>[color=green]
> > Note that style class names must start with a period. See below:[/color]
>
> No, class names should avoid starting with a period, otherwise you have to
> escape them in the style sheet, and that quickly gets messy.
>
> In a style sheet, the class selector starts with a period character - but
> the previous poster has done that. He simply combined the class selector
> with a type selector which is perfectly allowable under the specification.
> (Its worth avoiding since it adds slightly to the processing the browser
> has to do, but its not a serious problem).[/color]

DW will not allow a custom class name to start with any character other than
a period. On page 258 of DW3 for Windows and Mac it states "class name must
start with a period".
[color=blue][color=green]
> > <style type="text/css">
> > <!--[/color]
>
> Avoid this cargo cult. Its a waste of time and will cause problems with[/color]
any[color=blue]
> future migration to XHTML.[/color]

The OP made no mention of needing XHTML.
[color=blue][color=green]
> > font-size: 9pt}[/color]
>
> It would have been far more useful to pick up on this point though. Point
> units are, as has been discussed many times in the history of this group
> (and more in the ciwa.stylesheets sister group), entirely unsuitable for
> use on screen.[/color]

I didn't choose a fixed font size the OP did. As for using fixed font sizes
we must agree to disagree on this point. Personally I would have used
pixels to denote font size.

In closing I would ask why you made no attempt whatsoever to offer the OP
enlightenment regarding his query? Maybe the answer is because it's often
easier to criticize those who try to help rather than giving help yourself.
Signed,
me


me's Avatar
Guest - n/a Posts
#10: Re: CSS submit button problem

"David Dorward" <dorward@yahoo.com> wrote in message
news:d1cmmc$83h$2$8302bc10@news.demon.co.uk...[color=blue]
> me wrote:
>[color=green][color=darkred]
> >> <td class="formHead" colspan="2">TESTFORM</td>[/color][/color]
>[color=green]
> > For starters the table is busted. Note: colspan=2 below:[/color]
>
> He already has colspan=2. Although that element should be a caption or at
> least a table header cell rather then a table data cell.[/color]

My bad, eyes failing, tiny text in news reader, etc etc etc.
Signed,
me


David Dorward's Avatar
David Dorward July 24th, 2005 12:52 AM
Guest - n/a Posts
#11: Re: CSS submit button problem

me wrote:
[color=blue][color=green]
>> No, class names should avoid starting with a period, otherwise you have
>> to escape them in the style sheet, and that quickly gets messy.[/color][/color]
[color=blue]
> DW will not allow a custom class name to start with any character other
> than a period. On page 258 of DW3 for Windows and Mac it states "class
> name must start with a period".[/color]

Then either Dreamweaver is _very_ broken, or what it calls "class name" is
really a class selector. I'm betting on the latter.
[color=blue][color=green][color=darkred]
>> > <style type="text/css">
>> > <!--[/color]
>>
>> Avoid this cargo cult. Its a waste of time and will cause problems with
>> any future migration to XHTML.[/color]
>
> The OP made no mention of needing XHTML.[/color]

That doesn't make it wise to stick HTML comments in a style sheet.
[color=blue][color=green][color=darkred]
>> > font-size: 9pt}[/color][/color][/color]
[color=blue][color=green]
>> It would have been far more useful to pick up on this point though.[/color][/color]
[color=blue]
> I didn't choose a fixed font size the OP did.[/color]

Did I say otherwise?
[color=blue]
> As for using fixed font sizes we must agree to disagree on this point.
> Personally I would have used pixels to denote font size.[/color]

Pixels have their problems. Points have far more problems (all the problems
of pixels, with the addition of most systems interpeting them incorrectly).
Are you really disagreeing with the widely held assesment that points
(specifically points, not absolute units in general) are unsuitable?
[color=blue]
> In closing I would ask why you made no attempt whatsoever to offer the OP
> enlightenment regarding his query?[/color]

He didn't a provide a URL. My Windows machine isn't plugged in at the
moment. The solution to his problem was non-obvious.
[color=blue]
> Maybe the answer is because it's often
> easier to criticize those who try to help rather than giving help
> yourself.[/color]

Correcting bad advice is help.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
me's Avatar
Guest - n/a Posts
#12: Re: CSS submit button problem

"David Dorward" <dorward@yahoo.com> wrote in message
news:d1e1gp$8p8$1$8300dec7@news.demon.co.uk...
[snip]

Can you answer the OP's questions?
Signed,
me


David Dorward's Avatar
David Dorward July 24th, 2005 12:52 AM
Guest - n/a Posts
#13: Re: CSS submit button problem

me wrote:
[color=blue]
> "David Dorward" <dorward@yahoo.com> wrote in message
> news:d1e1gp$8p8$1$8300dec7@news.demon.co.uk...
> [snip]
>
> Can you answer the OP's questions?[/color]

Why are you obsessing over my ability to answer that question? It doesn't
alter the fact that the response you gave needed to be corrected.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
me's Avatar
Guest - n/a Posts
#14: Re: CSS submit button problem

"David Dorward" <dorward@yahoo.com> wrote in message
news:d1f3da$gcr$1$8302bc10@news.demon.co.uk...[color=blue]
> me wrote:[color=green]
> > "David Dorward" <dorward@yahoo.com> wrote in message
> > news:d1e1gp$8p8$1$8300dec7@news.demon.co.uk...
> > [snip]
> >
> > Can you answer the OP's questions?[/color]
>
> Why are you obsessing over my ability to answer that question? It doesn't
> alter the fact that the response you gave needed to be corrected.[/color]

The answers to those and other questions must be non-obvious to you. Have a
nice day.
Signed,
me


 
Not the answer you were looking for? Post your question . . .
196,816 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,816 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors