I'm having trouble with my understanding of how em should work in CSS. I'm trying to get an element (div in this case) to scale the same way the font does. I've narrowed my problem statement down as small as I can.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
body { font-size: 100%; }
.EventReg {
border:solid #000000 .063em;
background-color:#000000;
padding:.625em;
width:13.65em;
}
</style>
</head>
<body>
<div style="font-size:2em;">Event Registration</div>
<div class="EventReg"></div>
</body>
</html>
This seems to scale correctly in IE, FF, and Chrome, when I change body { font-size: 100%; } to any other percent.
What I'm expecting is what I see in a computer browser the div and the text are the exact same length. However, when I check this with my android smart phone the text is quite a bit wider than the div.
I would expect the div under the text to be the same width as the text even though it's scaled.
Any ideas what I'm doing wrong or where my assumption is wrong?