Quick way to make whole page in same font-family?


Exercise URL:

Error message:

Is it possible to make my all page in same font-family, font-size without writing again and again in every tags?

for example under <body> make something <??? style="font-family: Arial; font-size: 20px; color: blue">
and close it before </body>, or something like that?


You can put this in your css:

* { 
//Any css in here will be applied to the entire page


Do what sgt.schultz said. However you will need to either have your code in a CSS file, or otherwise put it between <style></style> tags.

You generally shouldn't be putting the styling in the HTML tag, it gets very messy and hard to maintain. The best way is to have a seperate CSS file, which can apply styling to every page of a website, as long as you link to it. Alternatively you can put your code between <style></style> tags, as I mentioned before, but it will only apply to that page.


Thanks Schultz and Andreobriennz! I haven't learned the CSS yet, but knowing that could answer my question also helps a lot.


you can add the following to your html code:

   body {
     font-family: Garamond;

i wouldn't use unversial selector here.


Thanks Andreobriennz and Stetim!
The code works, and I also tried font-size and color.

It seems to me that if the normal<style= " ">tag applied in the following lines, the system will give the normal one priority, which makes the <style></style> useless.
That totally makes sense to me why Andreobriennz you said that that will make things hard to maintain.



<style= " ">

is highly uncommon, you mean style attribute:

<p style="">

? Well yes, css needs a way to resolve conflicting properties, so there is a point system. The property with the most points get applied.

from the top of my head:
style attribute: 1000points
id selector: 100 points
class selector: 10 points
element selector: 1 point

you should check documentation if you really want to understand this point system

using <style></style> means you have an internal stylesheet, usually you have an external stylesheet (css code in separate file), its quit uncommon to use style attribute or internal stylesheet.

the external stylesheet, will make things more maintainable.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.