views:

92

answers:

1

Ok, here's the thing. I've done a webpage which contains forms and so I added buttons as elements and this works great. I created their own css classes and use graphics as background images for each of them. All working great (these are submit buttons btw)

Anyway, I've also got a jQuery script from before that takes all a href hyperlinks and add content from a set div from an external file and adds to a div in my current page, all in one animation. But this would probably not work with form buttons?

In any case I need to be able to have these buttons work as traditional hyperlinks anyway. So what do I do?

I thought about using css-buttons alltogether, but I'm not able to have them stack vertically. Using float left or right just put the buttons outside of their parent containers (probably a different fix for that).

But in any case, using css buttons, that wouldn't work as a submit button for the forms anyway would it? Should I perhaps use both form buttons and css buttons? What do you do?

+6  A: 

<button> elements.

You should never use links to submit data, users with javascript disabled won't be able to use them, crawlers can submit data accidentally, etc...

Javier Parra
thanks for the edit meagar, didn't know how to do that inline code :)
Javier Parra
No worries, I had hoped you'd pick up on it :)
meagar
Another reason for using a `<button>` is that it works better with assistive technologies like screen readers.
Donal Fellows
In conclusion, both <button> elements and CSS-buttons are what I really want then? Each for their own purpose? What are the differences between <button> and <input> anyway? Should I use button specifically?
Kenny Bones
you can have html inside a button element `<button type="submit" value="save"><img src="smiley.jpg" />Send us your data</button>` I say just make the buttons look like buttons and the links look like links :)
Javier Parra
Yeah, I can add images to buttons. And even styling the buttons completely. And that's basically what I'm doing. But I also need href buttons as well. And that was the problem, which one do I chose? Both? Or just one of them :)
Kenny Bones
If your button submits user supplied data use a button, if it doesn't use href.
Javier Parra
Thanks, just what I needed to know :)
Kenny Bones