Results 1 to 8 of 8
Apr 21, 2012, 01:36 #1
- Join Date
- Dec 2011
- 0 Post(s)
- 0 Thread(s)
Comparing 'ex' units to 'px' units
I totally confess to getting myself tied in knots with a coding issue and am appealing for help in establishing if my approach is correct or if I have I am off track and missing some really simple solution.
I am not sure if I should be posting here or in the php forum but I have opted for this forum first.
I wish to create a float based layout to display some mysql data. In order to make this dynamic and flexible 'ex' units have been used to size elements with in the layout and this works fine.
So I have built a couple of tables of Aspect Ratios assuming a default dpi of 96 with which I can convert from 'ex' to 'px' and visa versa. This works but it feels clumsy and I can't help thinking that there should be a more elegant approach to this.
The tables assume:
font in pixels = font in pts / 72 * 92
font in ex = font in pixels * aspect ratio
I note also that whilst my tables hold true to provide an approximate conversion for W3C compliant browsers they do not hold true for IE. I am concluding that IE uses a different default dpi or in some other way renders 'ex' units differently. Obviously using an appropriate assumed dpi resolves the problem with in my function but I would still like to understand why 'ex' units behave differently in IE.
I feel sure that relating 'ex' to 'px' must be a common layout issue so I am hoping that someone has a view on this an can guide me appropriately.