Ebook Sample Content Preview:
Here, we are using the font-size 62.5%, remember from earlier when we covered the font-size property, the percentage is based up line height. So the default font size will be 62.5% of whatever the line size is. So if we define different line heights in various places throughout our page and don't add a new define for the font size in those particular place, it will use the default 62.5%
Ok, I said earlier that we would go over what “em” is and since it's being used here, I guess this is as good a time as any. When using px to set font sizes, line heights, etc.. you are setting an exact number for that font or line height, etc.. which means that how it is viewed is dependent upon the viewers screen resolution. A 12px font will look differently on a 600x800 screen that it does a 1024x780 screen.
The em setting is basically a scalable size and how it is displayed is calculated based on the font-size property of the parent element.
What the body selector did above is set the default text size to be about 10px. 1 normal em is about 12px. So with this base established, you can use “em” instead of px to allow for scaling. Which means that your page can look the way you designed it on any resolution screen.
Just remember that the “em” calculates from whatever the parent size is. To explain, let's say we've kept our 1 em at 12px because we didn't scale it down by setting the 62.5% like we did in the wordpress css body css above.
So if we were to use 1.2em to define our paragraph text size, this would be multiplied by our default 12px for a slightly larger font, however if we had set our paragraph to 62.55% and then were working within a paragraph and set some text to be 1.2em, it would calculate on our already reduced 62.55% for a figure slightly larger than the 10px but less than 12px.
There really was no simple way to explain that. I hope you didn't get thrown off there, the main thing to remember is that you can always back your style.css file up and make changes until you get the look you want. They key is to not be afraid of it.
The cool thing is that we can also use the em to scale our images, so the whole page is able to expand and contract as needed to fit in the surfers screen, looking exactly as we intended it to look.
- File Size:565 KB
- License: Master Resell Rights
- Category:Ebooks
- Tags:2008 Ebooks Master Resale Rights