按钮和链接的字体大小 [英] Font-Size for Button and Link

查看:130
本文介绍了按钮和链接的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过这个简单的html:

I tried this simple html:

TEST FONT SIZE</br>
<input type="button" value="test bytton" style="font-size:20px">
<a style="font-size:20px">test link</a>

,发现此按钮的字体大小看起来比链接的字体大小的风格。
有没有人知道为什么风格对于链接和按钮的工作方式不同,以及如何使它们看起来一样?

and found out that the font size of this button looks bigger than the font size of the link in spite of style. Does anybody know why style works differently for link and for button, and how to make them looks like the same?

推荐答案

p> font-size是相同的。但是看起来不一样,因为默认的页面字体与默认的输入字段字体不同。将两个元素上的 font-family 设置为相同,它们看起来是一样的。

The font-size is the same. But it looks different because the default page font is different from the default input-field font. Set the font-family on both elements the same and they'll look the same.

body, input, button, select, option, textarea {
    font-family: ...; /* whatever font */
}
body {
    font-size: x%; /* whatever base font size I want */
}
input, button, select, option, textarea {
    font-size: 100%;
}

在页面和表单字段上获得一致的字体。

to get consistent fonts over the page and form fields.

这篇关于按钮和链接的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆