Default button color

Found out that the default button for input on a form is the first type submit

. This works, but what I will specify for the button is to make it look like the default button, i.e. selected. If I set the background color, it changes the appearance of the button from the default look of the button.

Here is the HTML form.

<form id="login_user_id" name="login_user_form"> 

<input type="hidden" name="id" id="id" value="add" /> 
<input type="hidden" name="edit_user" id="edit_user" value="y" />
<table cellspacing="0px"> <tr><td>Username or email:</td></tr><tr><td>
<input type="text" name="username_email" id="username_email" size="30" value="" class="inline_input"/></td> </tr> <tr><td>Password:</td></tr><tr><td>
<input type="password" name="user_passwd" id="user_passwd" size="30" class="inline_input"/></td> </tr> </table></td></tr> </table> 
<button id="login" type="submit" onclick="login_user(); return false;" style="width: 63px;">Login</button> 
<button id="cancel" onclick="cancel_login(); return false;" style="width: 63px; float: right; margin-right:8px; position: relative; top: -22px;">Cancel</button> 

</form>

      

0


source to share


2 answers


The statement "If I set a background color it changes the button's appearance from the default button appearance" pretty much sums up the limitations. You can style buttons, but many types of styles strip buttons of the functionality they have by default on the system. Browsers use some built-in routines for buttons to render, but many CSS tweaks cause them to deviate from this. It is generally impossible to mimic the overall style of a button, in part because it is system dependent, in part because it has rendering features that cannot be described in CSS as currently defined and implemented.

So the buttons just look like buttons. If you cannot do this, draw all your buttons in a certain way; it would be wrong for a non-standard button to look like a regular button, and the default button to look like something else.



There is no need to specify one of the buttons as the default button if you just remove the other button. (See Resetting a button is considered harmful .)

0


source


By default, buttons are rendered by the operating system and the browser has no control over how they look. If you start changing the CSS properties of a button, the browser takes over and draws the button in its own way. If you're looking for an easy way to get pretty buttons with different colors, try downloading. This is a very good CSS stylesheet, especially when it comes to building great looking forms.



http://twitter.github.com/bootstrap/

0


source







All Articles