Issue
Hello I am a new beginner to CSS, and I wondered if anyone could help to advise how I could set the font size for my entire webpage?
The tutorials I've been looking at just show me how to set font size for each separate section. I am using the same font-size for 99% of my page, so I don't want to have to code each and every single new paragraph, table row, cell, etc.
I'm already using a simple code for changing the font family for the ENTIRE page (see below), so I am assuming there is a simple code for the size that does the same.
<style>
*{font-family: Verdana;}
</style>
Thank you!
Solution
Set your font family and size in the body tag, and with a few exceptions, all the elements in your page will inherit that size:
body{
font-family: Verdana, sans-serif;
font-size: 12px
}
Optionally, you can set any of your elements to an em font-size:
p{
font-size: 1.5em;
}
1 em is equal to the font-size of an element's parent, so in this case the p tag is one and a half times the size of the div tag. Since the div tag is 12px (inherited from body), the p tag is 18px:
body{
font-family: Verdana, sans-serif;
font-size: 12px
}
p{
font-size: 1.5em;
}
<div>
<p>I'm in a p tag, my font size is 18px</p>
</div>
Answered By - symlink
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.