Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Styling of "submit" buttons

Tags:

html

css

I am wondering if anyone knows why the "default" style of a "submit" button looks pretty good (corners slightly rounded, some gradient from top to bottom, etc.) but the moment I add a background color it changes to a 1990's era square button with 2px border...just looks awful.

Can I somehow keep most of the default styling but change the background color? Thank you!

like image 812
user1149499 Avatar asked Dec 31 '12 16:12

user1149499


People also ask

How do I style a submit button in HTML?

you can style the Button as you wish. In the same way as in the previous answers, you can pimp your button selecting it using the input[type="submit"].

Can you style a Submit button with CSS?

The input type button can be a submit button or reset button. With CSS, we can style any button on a web page.

How do I customize a submit button?

The simplest way to do this is by using the WordPress CSS Editor. To open this, go to Appearance » Customize and select Additional CSS. Once you've opened the Additional CSS section, you can paste in your new CSS, click the Save & Publish button, and you're all set!


1 Answers

Browsers come with a big set of default styles to make things look pretty if the styles are not set by the website. For example Firefox has the following styles defined for the default submit button:

input[type="submit"] {
    -moz-appearance: button;
    -moz-binding: none;
    -moz-box-sizing: border-box;
    -moz-user-select: none;
    background-color: buttonface;
    border: 2px outset buttonface;
    color: buttontext;
    cursor: default;
    font: -moz-button;
    line-height: normal;
    padding: 0 6px;
    text-align: center;
    text-shadow: none;
    white-space: pre;
}

-moz-appearance is a non-standard property, that defines the style to be consistent with the operating system’s default button style. That’s why it will look different on different operating systems too.

like image 184
poke Avatar answered Sep 19 '22 18:09

poke