Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS for input type = button in Internet Explorer 4

Status
Not open for further replies.

Ascalonian

Programmer
Jan 4, 2008
264
US
I am trying to apply some CSS to a button in a form.

I am able to do:
Code:
input[type="button"]{...}

However, that does not work in IE (surprise, surprise). Is there another way to apply a CSS to a button without having to add the class or style attribute?
 
Well...

You can define in your CSS document the styles of all buttons (or all buttons within a particular DIV).

At least, I think you can do that.

That way, in your HTML, there's only a button call, but the CSS still controls how it looks.

But using "class" is pretty common.

How are you trying to change the appearance of the button?

[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
I want to create a common look-and-feel for every button used.

That is what I am trying to do. But I do not want to use class. This way, other developers don't have to think about always having to put it in.

I just need a solution that will work on both IE and Firefox. Although I am trying to push to make FireFox the default browser. :)
 
My solution to this problem is to simply do both

Code:
input[type="button"], input.button {
...
}

That way you can add a class if you want to support IE but if you neglect to add it then it will work in other browsers anyway (and stuff IE basically).

BTW, does the proper way work in IE7? If so then it might be worth pointing out that IE6 was launched 7 years ago!

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
I want to create a common look-and-feel for every button used."

So, say, defining how all buttons look and feel in the CSS, and then just calling out buttons in the HTML, and they adopt the style you assigned without needing to call out a class, id or anything. Would that do the trick?


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
I will agree with Foamcow in both that you can add a class to the declaration and I also think that IE7 supports the attribute selectors and that it would work in that browser without the class. Then all you have to do is wait for IE6 to die.

___________________________________________________________
[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top