I am currently doing one of the basic CSS projects on Codeacademy, Healthy Recipes.
One of the steps in the project was:
Finally, let’s make the font Helvetica instead of the default Times New Roman.
Instead of writing multiple selectors to apply the font-family property,
write a selector that applies a font-family attribute to all text at once.
The selector should target the h1 , h2 , p , and li elements.
Here is my question:
Is it wrong to choose ‘body’ selector to change all text at once?
What is the standard selector to use in this situation?
Note that the 100% means we accept the user set font-size that their machine is configured to. If they are used to large font, then they may have the default set to 32px. Our page would make this the value corresponding to 1em or 1rem.
If we don’t wish to change the base font, then why are we having this discussion? The choice of base font has fallen to us. Why any font family? Because we are setting the base. What we choose as that base is our choice, according to our design parameters. I used “Helvetica” for Apple devices, “Arial” for Windows devices, and sans-serif as the default for all other devices that don’t recognize either. This is the standard way of writing for browser compatibility.
The order is important. Start with the font that is least likely to be supported, and go from there to the next… and down to the one that all will support, sans-serif, given that these fonts are members of that generic font family.
Very useful and informative article, I also learned a lot of new things for myself. Thank you for sharing this information. Programming is probably the only thing that I manage to write. Because at the university I always had difficulties with writing essays and various research papers, for this I always needed help. And if I hadn’t found in time https://ca.edubirdie.com/research-paper-help, I don’t know how I would write all these works on my own. But with programming I have a lot better since it’s interesting to me and I’m happy to try to figure it out and maybe, if I put in a lot of effort, I’ll be a good specialist.
The universal selector is harder to override so should be carefully implemented when the real need is present. For your situation, simply give the whole document the font you wish to use.
body {
font-family: Verdana, Helvetica, sans-serif;
}
That will be inherited by all children at every level.
Hello there! I came across your blog and I must say, your articles on Java programming are really informative and interesting. University Homework Help