How to use the EM unit in CSS
Thursday, May 15th, 2008Everybody on the web agree, that dynamic and scalable font size are the way to go. And this is where the .em unit is perfect.
Everybody on the web agree, that dynamic and scalable font size are the way to go. And this is where the .em unit is perfect.
A problem frequently met, is centered design jumping in Firefox. Its caused by the browsers default scrollbar behavior. The scrollbar in Firefox is only shown, if its needed.
So in a centered design, if you have a page with no scrolling linking to another page with scrolling, you will see the page jumping. This is caused by the scrollbar appearing and disappearing, making the viewport 18 pixel slimmer.
A way to avoid this, is to show the scrolbar at all times, with this CSS:
html {
overflow-y: scroll;
}
Of course you can reverse this, and have the "scrollbar on demand" feature in IE also:
html {
overflow-y: auto;
}