akmur
akmur

Reputation: 1635

CSS working only with !important

I am facing the strangest issue.

I am just starting out on a new website, and I have something like:

html {
   font-family: Arial, sans-serif;
}

Well, my text turns out to be in Serif. If I check in inspect element, it shows as crossed out. If I search in the stylesheet, i find only this spot with a font-family declaration.

If I add !important then Arial works.

Anybody knows what's going on? Thanks

Upvotes: 1

Views: 316

Answers (1)

Stickers
Stickers

Reputation: 78696

In general font-family should be set on the <body> tag, not <html>. It's likely that you have the serif font set on the body which overwrites the rule.

In reply to the comments, you set the font-family above the global reset, which is wrong. There is html {font: inherit;} in the reset which overwrites the rule you set above, and the browser default font is serif in most of the case. That's why it renders serif instead of arial.

Upvotes: 2

Related Questions