2

I have some trouble trying to define styles to form buttons. My application has to be IE6 compatible, which means I can't use attribute selectors. I added a class to each button instead.

Here is the code of one of my buttons (ASP.Net auto-generated code)

<input type="submit" name="ctl00$cphContenu$adminTabContainer$adminTabAccueil$ctl01" value="Valider" class="formBouton" />

And here are the CSS definitons that should affect it

*
{
    font-family:verdana, sans-serif;
    font-size:12px;
    margin:0;
    padding:0;
    border:0;
}

input, textarea, select
{
    border:2px inset #ccc;
}

.formBouton
{
    border:2px outset #ccc;
}

The result is a button with an inset border. My first clue was that some other CSS in my style sheet was interfering, so I checked with Firefox's web developer toolbar which styles were applied to my button. Only two selectors are used : universal selector, and tag selector. No unwanted definitions are applied and the class is not taken into consideration at all. And I have no clue why.

EDIT : Thanks to IE6 being slow, I had the time to see what was actually happening : my class worked as intended but was suddenly removed during load time (which is why it didn't appear in wed dev toolbar). It was actually aa bug in my JS code. Thanks to all who tried to help. :)

Thibault Witzig
  • 2,060
  • 2
  • 19
  • 30

2 Answers2

1

I suppose it's because in IE6 you cannot style the border with CSS as you like. A workaround is to remove the border of the button with border: 0 and to wrap the button with a span that as a border. You can see an example here: Any way to remove IEs black border around submit button in active forms?

Community
  • 1
  • 1
ordnungswidrig
  • 3,140
  • 1
  • 18
  • 29
  • This is a good thing to know, thank you. Unfortunately, that doesn't help with my problem. I have the same issues with Firefox and IE, and I can't define a border:0 to my button if doen't even read the code in the class definition. :/ – Thibault Witzig Jan 28 '11 at 08:55
0

I't been awhile since I've programmed for IE6, but doesn't any button in a form trigger a submit action? Even if it's not an input submit?

Another option would be to take a button and have that generate a form submit action onclick. This would then allow you to style the button as you like.

Exelian
  • 5,749
  • 1
  • 30
  • 49