问题
Is it possbile to get the default Chrome button style in CSS?
Of course many would say use http://pastebin.com/zjkW2cJe or http://pastebin.com/xKGBZFPg
But i want this button CSS code...
回答1:
If you want the pure CSS rules, you can inspect the button element and check out the entries saying "user agent stylesheet".
In my Chrome 9, they look like this:
input, textarea, keygen, select, button, isindex, datagrid {
margin: 0em;
font: -webkit-small-control;
color: initial;
letter-spacing: normal;
word-spacing: normal;
....... etc. much more
however, if you literally want the rules for natively rendering a button, in order to render the same button in other browsers, I think that's impossible: A default button will be rendered by the Browser's UI or even the underlying operating system. In my Windows 7, the default button looks like this:
This style, as far as I know, is not in the CSS rules. You would have to rebuild it using background images, borders, rounded corners etc. If you don't mind using jQuery, libraries like jQuery UI have seducingly simple solutions for this.
回答2:
You want them... visually? If so, inspect the element and look at the computed styles.
回答3:
In current Chrome on macOS, it is something like this:
background-image: linear-gradient(to bottom, #e4e4e4, #f7f7f7);
border: 1px solid #afafaf
来源:https://stackoverflow.com/questions/5031979/chrome-default-button-style