If you have a single submit button on a HTML form can you supply alt text that will display with images disabled IF you are using a CSS sprite for a background image?
With <input> you can use the alt attribute without error (I am guessing because you can use a simple static image as the button with type=“image” and src=“image.jpg”), however, <button> does not allow alt to be used.
The alt text does show up with images disabled, but the text itself “runs away” due to the text-indent:left; on hover so you can only SEE it, but not click it. :headbang:
Well, usually it’s easy to position a span over something for the purposes of a sprite. I’m just confused as to why the button element is so resistant to this method. Obviously something I’m missing.
Ralph I don’t have send.jpg…can you upload that example online? I feel like I should know why this isn’t working. I think I’ve ran into something like this b efore
In case it helps, I made another page just with Ralph’s attempted solution.
I also noticed it does indeed work in the current version of Chrome (7.0.517.41) (contrary to that article - wonder if the Google devs will share that tidbit with Mozilla).
It’s not the prettiest solution as it A) relies on a <div> element for the :hover pseudo class and B) creates another HTTP request (with the blank.gif). The :hover IE problem can be fixed with a .htc, but still seems like there should be a simpler solution.
I know <button> is meant for styling submit buttons, but I just couldn’t figure out that offset bug.
So far, the alt text shows up with images disabled on FF, Chrome and Opera (Mac).
Safari does not display the alt text (or any other alt text from other websites - am I late to the party on realizing this one?).
I haven’t tested it in IE yet (PC is unavailable).
Chrome will only display the alt text if it’s narrower than the image so one is limited by the dimensions of the blank.gif.
If I have to use a generic submit button then so be it, but damnit I don’t want to let the summabeach win. :scratch:
It works in IE8, but with IETester IE6 & 7 do not display any alt text (or on normal images with regular alt text) so I cannot use that as a valid test.
I cringe as I write this, but would it be safe to assume IE6 & 7 would display alt text the same way as IE8?
If you want you can actually use the submit button with a sprite and is a better alternative because image inputs don’t supply the name value pairs by default and require additional javascript.
No you won’t find much documentation about this but it’s another strange IE quirk and the negative text-indent in the input doesn’t work unless you set it to text-transform:capitalize. There is no rhyme or reason for it and it’s much like the way that display:inline fixes the double margin float bug for no reason other than it does.
The label and the input are both made exactly the same size and then the input is placed on top of the text in the label thus hiding it.
If images are missing or turned off then you see the label text that is under the transparent input and you still know that you have to click it.
If on the other hand css is turned off you get a proper submit button as usual and it also a label to the side. It’s a win win situation and semantically sound as the label is associated with the input and provides extra meaning. The submit button is also doing the job it was designed for.
The input type=image isn’t a bad solution but doesn’t automatically pass the name value pairs like an input but I know you can add extra details with hidden inputs anyway.