2014-03-07 40 views
0

我正在使用html5,並且我想使div完全像默認的html5按鈕。有什麼辦法讓div看起來像使用css的默認按鈕一樣嗎?爲div創建默認html5按鈕css?

+1

是,採取該按鈕的樣式,並將其應用到一個div。 – Shomz

+0

你怎麼能告訴我 –

回答

4

使用CSS3appearance屬性爲:

div{ 
 
    appearance: button; /* CSS3 */ \t 
 
    -webkit-appearance: button; /* Safari and Chrome and opera */ 
 
    -moz-appearance: button; /* Firefox */ 
 
    -ms-appearance: button; /* Internet Explorer */ 
 
}
<div>button</div>

+1

只是一個說明:你的解決方案不適用於IE和Opera - [參考](https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-外觀) – Vucko

+0

@Vucko是的,你是對的 –

+0

'appearance:button;/* CSS3 */\t -webkit-appearance:button;/* Safari和Chrome */ -moz-appearance:button;/* Firefox */ -ms-appearance:button;/* Internet Explorer */ -o-appearance:button;/* Opera * /' –