This forum is now read-only. Please use our new forums at discuss.codecademy.com.

CSS: An Overview Forum

View Course » View Exercise

107 points
9027db693cac218bfa8523f4aaa451fe?s=140&d=retro
Submitted by
hbpeckham
almost 3 years ago

Why Style in HTML AND CSS? Please clarify some questions for me.

I am curious as to why one would bother to set the style in html here, and then to do the same again in CSS. What is the purpose of specifying serif in both areas, backup value or no?

I understand the concept of using times as the ideal font and serif of the backup, I just do not understand why one would bother to include specifying a font family in HTML if you are going to offer two font options/formats in CSS.

Can someone clarify for me? Does this HAVE to be done, or if it for the purpose of illustrating this for students?


1 vote

permalink

Not really sure what the question is...

Fonts:

It's a common failure of uninformed or misinformed developers to want to impose the font selection of their choice because it looks good on their computer. They fail to consider anybody else. Big fail. If we want to see what our pages look like for real, then we should do it on a stranger's computer, or several strangers' computers. This will be a real eye-opener.

Windows machines come equipped with a different font collection than Macs, and the range of other devices out there all have their own built in fonts. Not every machine is the same and not all the fonts on one machine are available on another. Once we begin installing our own fonts, this magnifies the problem even further.

That is why the font-family property is set up to accept a list of families, written in order of preference.

MyFavoriteFont, TheBestSubstitute, AMacFontSubstitute, ASuitableFont, AFontEveryoneWillHaveMaybe, generic_family;

When a font is not present, the browser can fall back on the next in the list. If that one is not present, fall back again. If none are present, fall back to the generic family.

"Times New Roman" can fall back to Times, and then serif. A quick search will help build a list of the most common serif type fonts. Another search can find sans-serif fonts, mono-space fonts, cursive fonts, and fantasy fonts. There are way more fonts out there than would be found on any one machine, and the choice of most common fonts is a short list, at best. Make your pages friendly and allow for this at all times.

8115 points
5958b8ebe12813a2a3000034_980106998
Submitted by
Roy
almost 3 years ago