简体   繁体   English

body标签中的CSS font-weight问题

[英]CSS font-weight issue in body tag

i've been having a small issue with the font-weight property, when I put it into the body tag, it doesn't seem to work.(I have a < h1 > tag in my HTML which I don't want in bold). 我一直有一个font-weight属性的小问题,当我把它放入body标签时,它似乎不起作用。(我的HTML中有一个<h1>标签,我不想要胆大)。 Of course if I would put the font-weight:normal; 当然如果我把font-weight:normal; property inside the " * " it works. “*”内的属性可行。 But it doesn't when I leave in the body. 但是,当我离开身体时,它不会。 I know I can just use a h1 tag and put the font properties in there, but I'm curious as to why it isn't working for me. 我知道我可以使用h1标签并将字体属性放在那里,但我很好奇它为什么不适合我。

Thanks , and here is my CSS code. 谢谢,这是我的CSS代码。

* {
margin:0px;
padding:0px;


}
body {
background-color: #DCDBD9;
color: #2C2C2C;
font-weight:normal; /*this doesn't seem to work*/
font-size:100%;
font-family: Cambria, Georgia, sans-serif;
}
  • The * selector will explicitely set the font-weight to each individual element, thus overriding the default font-weight:bold of an h1 *选择器将明确地为每个单独的元素设置font-weight ,从而覆盖默认的font-weight:bold h1 font-weight:bold

  • Setting font-weight:normal to body won't change a thing, since the default font-weight value for body is normal. 设置font-weight:normal to body不会改变任何东西,因为body的默认font-weight正常的。

  • The font-weight property on body won't be inherited by children who have a browser default font-weight, such as an <h1> or a <strong> tag. 具有浏览器默认字体粗细的子项(例如<h1><strong>标记)不会继承body上的font-weight属性。

你为什么不把font-weight:normal放在CSS的h1部分?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM