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). Of course if I would put the 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.
Thanks , and here is my CSS code.
* {
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
Setting font-weight:normal
to body won't change a thing, since the default font-weight
value for body
is normal.
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.
你为什么不把font-weight:normal
放在CSS的h1
部分?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.