Reputation: 3831
I use em
for everything size related in my website. I am now implementing adds with adsense, and those add blocks come in pixels. How should I integrate something that is measured in pixels into a site that does everything in ems?
Upvotes: 1
Views: 29
Reputation: 574
I recommend you to use EMs as much as possible. The reason why I go this way is for example when I zoomed page with elements sized in pixels, there sometimes happened strange artifacts on some zoom levels. When stasted to use EMs, that issue was gone.
By default, calcuations formula is 1em = 16px, but be aware when somewhere is set font size. If you have for example span element and set it's font size to 2em and then width to 8em, the result will be that span will be 256 pixels wide, not 128.
<span id="oneem">font 1 em</span>
<br><br>
<span id="twoem">font 2 em</span>
http://jsfiddle.net/Kovo/4F8LH/
Upvotes: 1
Reputation: 1403
You can still use pixels, even though everything you else you have uses ems. Or you could just convert the pixels into ems. The best answer is really going to depend on how you're bringing it into the site.
Upvotes: 2