开发者

How to apply CSS to buttons?

I want apply CSS to all my buttons but not referencing all buttons id in my CSS stylesheet. How to proceed?

<button id="buttonEdit">Save</button>
开发者_如何学C

I already try:

input[type=button]
{
    fonr-size: 80%;
}

but this doesn't work.

Thank you.


button, input[type=button]
{
    font-size: 80%;
}

The element is button, not input


You are referring to a button, not an input field, so you should use the correct term in css.

button
{
    font-size: 80%;
}


You are not using an input with type="button", but a button element:

button
{
    font-size: 80%;
}


Do you have styles associated with the buttonEdit id in your CSS?

I've just copied in your button to a "Try It Yourself" area on W3Schools, and added my own style in the header

button { font-size: 80%; }

As everyone else has already posted, and it worked. I did a before test to see the button, then added the style & refreshed. Button text got smaller.

If there are no styles associated with buttonEdit that could be messing things up, then I'd triple check you didn't accidentally forget the colon after font-size.


A quick and nasty fix is just to put style="style:value;" in every button tag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜