Hi,
How can I use a CSS class for all submit buttons? Like
ThanksCode:input { /* is used for all form elements */ } input:submit { /* something like this but is actually real CSS :P */ }![]()
| SitePoint Sponsor |
Hi,
How can I use a CSS class for all submit buttons? Like
ThanksCode:input { /* is used for all form elements */ } input:submit { /* something like this but is actually real CSS :P */ }![]()




Hi, you'll need to look into attribute selectors for CSS.
http://www.google.com/search?q=css+attribute+selector
something like this...
should do the job. not sure if there's any other way (avoiding a class assignment in your (x)html )...Code:input { /* is used for all form elements */ } input.whatever { /* something like this but is actually real CSS :P */ } --------------------- <input type="submit" name="submit" id="submit" class="whatever" />
re·dux (adj.): brought back; returned. used postpositively
[latin : re-, re- + dux, leader; see duke.]
WaSP Accessibility Task Force Member
splintered.co.uk | photographia.co.uk | redux.deviantart.com




redux, using attribute selectors for this is a neater way.
Of course the disadvantage would be spotty browser support.
heh...i'm still learning basic CSS, so i have to plead ignorance on the technique of attribute selection...but now that i've looked at it, all i can say it...wow.
so, something like this then ?
Code:input { /* is used for all form elements */ } input[type="submit"] { /* something like this but is actually real CSS :P */ } --------------------- <input type="submit" name="submit" id="submit" />
re·dux (adj.): brought back; returned. used postpositively
[latin : re-, re- + dux, leader; see duke.]
WaSP Accessibility Task Force Member
splintered.co.uk | photographia.co.uk | redux.deviantart.com
You're almost there redux! input[type="submit"] is actually a CSS2 attribute selector and does work, but not in all browsers. It does work in Mozilla and I believe it works in Opera 7, but IE is still the big holdout in CSS2 support here. Personally, I use the CSS2 unless a client requests otherwise. I figure once they upgrade (or if IE7 supports CSS2 more) they'll get a nice treat on their site when they log in.Originally posted by redux
so, something like this then ?
Code:input { /* is used for all form elements */ } input[type="submit"] { /* something like this but is actually real CSS :P */ } --------------------- <input type="submit" name="submit" id="submit" />
Bookmarks