Tip Details Add a Related Tip

Rate as: Positive Negative

Submitting web forms without buttons

Many newer web browsers are starting to ignore the CSS directives related to buttons on web page forms. While this does lead to a more consistent look and feel on the desktop, ignoring the CSS and create system-type buttons can really mess up the look of a web page that is trying to create a consistent them.

As a result of this, many web designers are doing away with buttons on their forms altogether. Instead they use links (hrefs) inside of a div or a span element and they then style the div or span element to look like a button. This way the form will look consistent across all browsers.

The one problem with this approach is that if there are no buttons for the form, the user can no longer press the Enter key on the keyboard to submit the form. A lot of people don't like this since they then have to go from the keyboard to the mouse to submit the form.

If you are running into this problem on your web pages, there is a nice little fix you can use that will allow you to control the look of the buttons while keeping the form submission via the Enter key working. You can do this by adding a simple button of type submit to your form and then styling the button so that it is not visible. It won't affect your look at all. And since the browser thinks that there is a submit button in the form, hitting the Enter key will still work. Here's some code snippets as to how this looks...

...

<style type="text/css">
   button.hiddenSubmit {
      visibility: hidden;
   }
</style>

...

<form ...>

...

   <button type="submit" class="hiddenSubmit"></button>

...

</form>

...

Doing this will allow you to fully control the style of your buttons while leaving the page so that the user can hit the Enter key to submit the form.
Rating: 100% positive, 1 Vote
Categories: web design web development programming HTML CSS
Added: on Aug 06, 2008 at 8:16 am
Added By: an anonymous user

Comments on this Tip

Add a Comment
This works in Firefox and Safari, but not in IE7. I don't know about IE6.
– Added by an anonymous user on Aug 06, 2008 at 1:26 pm
Your Comment:
(how to format)
Rate This Tip:

Verify Humanity:
Sorry, we know it's annoying, but please enter the characters shown in the image to the left so that we know you're an actual person and not an evil spammer. Thanks.
       

Related Tips

How to Send E-Mail in PHP: A “Share This” Form

33% positive, 0 comments
– Tip added by Walkere on Feb 06, 2008 at 6:45 pm

Telling when an iframe is done loading

100% positive, 1 comment - last added on Sep 07, 2008 at 10:57 pm
– Tip added by an anonymous user on Apr 18, 2008 at 8:05 am

Easy way to create .htaccess files

100% positive, 0 comments
– Tip added by an anonymous user on Apr 01, 2008 at 7:57 am

How to Find a Random Date in PHP

20% positive, 0 comments
– Tip added by Walkere on Feb 07, 2008 at 8:25 pm

Best Font Size for Web Design

Categories: web design fonts css
100% positive, 0 comments
– Tip added by an anonymous user on Oct 24, 2008 at 2:13 am

Learn By Doing

100% positive, 1 comment - last added on Oct 25, 2008 at 12:28 pm
– Tip added by an anonymous user on Aug 25, 2008 at 2:00 am

Use firebug to debug or just make sense of complex sites

100% positive, 0 comments
– Tip added by an anonymous user on May 23, 2008 at 8:41 am

Our best moment was the sunset...

50% positive, 1 comment - last added on Apr 02, 2008 at 5:56 pm
– Tip added by Billy Cenea on Apr 02, 2008 at 5:49 pm

How to Create a Custom RSS 2.0 Feed for Your Site with PHP

100% positive, 1 comment - last added on Feb 15, 2008 at 7:49 am
– Tip added by Walkere on Feb 15, 2008 at 7:39 am

How to Create a Random Password in PHP

100% positive, 0 comments
– Tip added by Walkere on Feb 03, 2008 at 9:14 am

Use a javascript lightbox to display pictures

100% positive, 0 comments
– Tip added by an anonymous user on Nov 19, 2007 at 5:45 pm

Create your own customized wordpress theme

no ratings, 0 comments
– Tip added by an anonymous user on Nov 17, 2008 at 10:56 am

empty table cells in IE6

Categories: HTML CSS IE6
no ratings, 0 comments
– Tip added by an anonymous user on Nov 11, 2008 at 12:24 pm

Find unused CSS in your style sheets

Categories: CSS coding web design free
no ratings, 0 comments
– Tip added by an anonymous user on Jul 14, 2008 at 10:43 am

E-Commerce Web Site Development, London, UK

no ratings, 0 comments
– Tip added by obsgroup on Jun 12, 2008 at 5:15 am

CakePHP: Working with Associations

no ratings, 0 comments
– Tip added by an anonymous user on May 08, 2008 at 4:09 am

Javascript: How to Create a Random Number

0% positive, 0 comments
– Tip added by Walkere on Feb 23, 2008 at 9:49 pm

CSS drop shadow without images

Categories: CSS web design
no ratings, 0 comments
– Tip added by an anonymous user on Jan 02, 2008 at 8:16 am

CSS Menu Navigation

Categories: CSS web design coding
no ratings, 0 comments
– Tip added by messy-me on Sep 05, 2007 at 6:09 am

Code for creating Javascript CSS charts

no ratings, 0 comments
– Tip added by an anonymous user on Aug 21, 2007 at 12:23 pm