gpt4 book ai didi

css - 为什么 <textarea> 和 不从正文中获取字体系列和字体大小?

转载 作者:太空宇宙 更新时间:2023-11-03 18:09:05 26 4
gpt4 key购买 nike

为什么 Textareatextfield 没有从正文中获取 font-familyfont-size

请在此处查看实例 http://jsbin.com/ucano4

代码

        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>texearea font</title>
<style type="text/css">
body {
font-family: Verdana, Geneva, sans-serif;
font-size:16px
}
</style>
</head>
<body>
<form action="" method="get">
<textarea name="" cols="20" rows="4"></textarea>
<input name="" type="text" />
</form>
<p>some text here</p>
</body>
</html>

如果这是一种常见的行为,那么我应该像这样在 css 中编写。我需要所有相同的样式

body,textarea,input  {
font-family: Verdana, Geneva, sans-serif;
font-size:16px
}

XHTML 中还有多少其他元素不会采用 body {....} 的字体样式?

最佳答案

某些控件默认不继承字体设置。你可以通过将它放在你的 CSS 中来覆盖它:

textarea {
font-family: inherit;
font-size: inherit;
}

关于css - 为什么 &lt;textarea&gt; 和 <textfield> 不从正文中获取字体系列和字体大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24107215/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com